07-25-2023, 11:40 AM
Strings are arrays of characters.
char name[] = "John";
printf("Name: %s\n", name); // Output: John
// String input using scanf()
char city[50];
printf("Enter your city: ");
scanf("%s", city);
printf("City: %s\n", city);
char name[] = "John";
printf("Name: %s\n", name); // Output: John
// String input using scanf()
char city[50];
printf("Enter your city: ");
scanf("%s", city);
printf("City: %s\n", city);
Also follow me on Youtube for videos about video games:
https://www.youtube.com/channel/UCxfkGVU...2mQ/videos
https://www.youtube.com/channel/UCxfkGVU...2mQ/videos