View Single Post
Old Oct 14th, 2005, 9:33 PM   #4
aznluvsmc
Hobbyist Programmer
 
Join Date: Aug 2005
Posts: 137
Rep Power: 4 aznluvsmc is on a distinguished road
If both are essentially equivalent. Isn't there still a limitation on strings2[5][21] where each one dimensional array should only be 20 characters long since the max element is 21? However *strings1[5] imposes no limitation on the length of the string since it's a point to another memory location.

Also is the following code correct?

[code]
int main(void)
{
char *strings1[5];
char strings2[5][21];

strings1[0] = "Hello"; //this will assign the beginning address of the Hello string to the first element?

strings2[0] = "Hello"; //invalid because strings2[0] is an array?
}
aznluvsmc is offline   Reply With Quote