how initialize character and string data types?
Answers
Answered by
0
Declaring and Initializing a string variables:
1. // valid char name[13] = "StudyTonight"; char name[10] = {'c','o','d','e','\0'}; // Illegal char ch[3] = "hello"; char str[4]; str = "hello";
2. char str[20]; printf("Enter a string"); scanf("%[^\n]", &str); printf("%s", str);
3. char text[20]; gets(text); printf("%s", text);
✨⚡
Similar questions