Character Array MCQ 2 : String Assigned to Character Array



Character Array MCQ 2 : String Assigned to Character Array


Predict the Output of the Following Program ?

#include<stdio.h>

void main()
{
char str[]="Learn C Programming Language";
printf("%s",str);
}

Options :

  1. Error : Declaration not Allowed
  2. Learn C Programming Language
  3. Array Size not Specified
  4. None Of these

Output:


Switch to String MCQ Home : Click Here


How and Why ?

  1. 29 Character Space is Allocated for Initialized String
  2. Array Size is Automatically Calculated.
  3. Array Size = Length of the String [Here 29]
  4. NULL Character is Automatically Appended at the End of String
  5. For More Details : Click Here [String Initialization Techniques ]