Home » C Programming » Strings

What will be the output of the program? #include int main() { char str = "CuriousTab"; printf("%s\n", str); return 0; }

Correct Answer: Error

Explanation:

The line char str = "CuriousTab"; generates "Non portable pointer conversion" error.


To eliminate the error, we have to change the above line to


char *str = "CuriousTab"; (or) char str[] = "CuriousTab";


Then it prints "CuriousTab".


← Previous Question Next Question→

More Questions from Strings

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion