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 :
- Error : Declaration not Allowed
- Learn C Programming Language
- Array Size not Specified
- None Of these
Output:
Switch to String MCQ Home : Click Here
How and Why ?
- 29 Character Space is Allocated for Initialized String
- Array Size is Automatically Calculated.
- Array Size = Length of the String [Here 29]
- NULL Character is Automatically Appended at the End of String
- For More Details : Click Here [String Initialization Techniques ]