C

Chandani • 9.82K Points
Tutor III

Q. Consider the below statement, can we assign a string to variable like this:

Code:
char c[100];
c = "C programming";
  • (A) Yes
  • (B) No
  • (C) ---
  • (D) ---

Explanation by: Chandani
No, we cannot assign a string like this. Because string is a character array and array type is not assignable. To assign a string to the character array, we need to use strcpy() function.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.


Question analytics