I under stand why you have to use a Multidimensional Array to make a string:
#include <iostream.h>
#include <string.h>
main()
{
char name[2][8];
int endprogram;
strcpy(name[0],"Hello");
strcpy(name[1],"David");
cout << name[0] << endl;
cout << name[1];
cin >> endprogram;
return(0);
}
But I do not understand why, when using a structure, you dont have to use a Multidimensional Array for the field:
#include <iostream.h>
#include <string.h>
struct planet {
char x[11];
};
main()
{
int endprogram;
struct planet name;
strcpy(name.x,"Hello");
cout << name.x << endl;
cin >> endprogram;
return(0);
}
Can some one please explain this to me? I look like this guy at the moment