+ 1
What is the difference between character array with and without null terminating character ?
4 Answers
+ 3
#include <stdio.h>
int main() {
char string[4] = {'a','b','c',0};
printf("%s\n",string);
char array[3] = {'a','b','c'};
int i;
for (i=0; i<3; ++i) {
printf("%c",array[i]);
}
return 0;
}
+ 3
a char array with a null terminating char could be safely used as a string...
while without it must be handled as an array, by knowing its length ^^
+ 1
Previously related thread, seems to be the root of the question ...
https://www.sololearn.com/Discuss/2794334/?ref=app
0
visph Can u please elaborate these two cases along with a sample code for both …
Hot today
Please help, any idea?
2 Votes
Loop question, I've tried everything that I knew I just don't know. Please help me solve it out
1 Votes
What is wrong? Error on test.
1 Votes
Help me solve this (using loop)
1 Votes
Help me wiht python
1 Votes
how can i flip any word with c++
0 Votes