Hi,
when I try to assign \0 using the expression:
pPtr->myArray[127]="\0";
my compiler throws the following error: "invalid conversion from ‘const char*’ to ‘char’.
Any idea on what's wrong? Any idea on how to solve the problem?
Hi,
when I try to assign \0 using the expression:
pPtr->myArray[127]="\0";
my compiler throws the following error: "invalid conversion from ‘const char*’ to ‘char’.
Any idea on what's wrong? Any idea on how to solve the problem?
That's because you enclosed the \0 in double quotes. Change it to single quotes pPtr->myArray[127]= '\0';
If myArray is less than 128 bytes then the above will cause buffer overflow.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.