int main(){
char *c=(char*)malloc(4*sizeof(char));
*c='a';
c++;
*c='b';
c++;
*c='c';
c++;
*c='\0';
printf("%s",c);
return 0;
}
With this code I can print every single character (e.g. printf("%c",*(--c)); ), but when I try to print the whole string using printf("%s",c); the program prints nothing! Why is this happening ?
cto the last character'\0'... So nothing to print.printf("%s",c);cpoints to\0