Interview Questions

If I can say... why can't I say...

C Interview Questions and Answers


(Continued from previous question...)

If I can say... why can't I say...

Q: If I can say
char a[] = "Hello, world!";
why can't I say
char a[14];
a = "Hello, world!";

A: Strings are arrays, and you can't assign arrays directly. Use strcpy instead: strcpy(a, "Hello, world!");

(Continued on next question...)

Other Interview Questions