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);