A

Admin • 833K Points
Coach

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) ---
  • Correct Answer - Option(B)
  • Views: 27
  • Filed under category C Programming
  • Hashtags:

Explanation by: Admin

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.