0
Why this code has no output?
char *str = "12345"; printf(" %s", *str);
1 Odpowiedź
+ 4
*str means you are dereferencing a character, at the address pointed by pointer <str>. The problem here is you are using %s which is meant for string rather than character. Use %c instead of %s and you will get output.
Use %s if you want to print the string, but don't use dereference operator '*', -> printf(" %s", str);