QP School

Full Version: Working with strings in C
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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);