Character Array MCQ 1 : String Assigned to Character Pointer in C Programming Language
String / Character Array MCQ 1 : String Assigned to Character Pointer
Predict the Output of the Following Program ?
#include<stdio.h> void main() { char *str="Pritesh"; printf("%s",str); }
Options :
[arrowlist]
- Error : Declaration not Allowed
- Pritesh
- Illegal Pointer Initialization
- None Of these
[/arrowlist]
[toggle title=”Output”]Pritesh[/toggle]
How and Why ?
- String Can be Initialized to Character Pointer
- Here Base Address of the String is Stored in Pointer Field
- For More Details : Click Here [String Initialization Techniques ]