how to read a string with spaces from keyboard in c code example
Example: read string with space c
char name[30];
char temp;
printf("Enter age: ");
scanf("%d", &age);
printf("Enter name: ");
scanf("%c", &temp); // temp statement to clear buffer
scanf("%[^\n]", name); // read until newline