In a book I am reading they say you can not use pointer notation to declare array. But he then goes and does this
isn't a string a character array?Code:*pointer = "This is a string!";
In a book I am reading they say you can not use pointer notation to declare array. But he then goes and does this
isn't a string a character array?Code:*pointer = "This is a string!";
Yes and no. That creates a string literal, which is unmodifiable. You can change what the pointer points to, but not the contents of that string.
Quzah.
Hope is the first step on the road to disappointment.
Hi,
Actually a string is char array only. But if you declared it as array then baseaddress cannot be modified but the contents can be modified. But you can make a pointer to point to a string. Here you can change the base address of pointer and can change the content.
Saravanan.T.S.
Beginner.