Answers for "reading string with spaces in c"

C
1

reading string with spaces in c

scanf ("%[^\n]%*c", name);
Posted by: Guest on September-14-2021
0

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
Posted by: Guest on January-17-2021

Code answers related to "C"

Browse Popular Code Answers by Language