read string with space c
#include <stdio.h>
int main(){
char name[20];
printf("Enter a name : ");
scanf("%[^\n]%*c", &name);
printf("the name entered is: %s\n", name);
return 0;
}#include <stdio.h>
int main(){
char name[20];
printf("Enter a name : ");
fgets(name, 20, stdin); // fgets(variable_storing_to, accepted_input_size, stdin)
printf("the name entered is: %s\n", name);
return 0;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
Also in C:
- logging.logger
- even odd c
- how to add user to role postgresql
- turn a char array into double C
- global and local variables in c
- strdup c
- inurl:fiu.edu math faculty
- latex noindent
- c \a
- Access denied creating xampp-control.ini
- sum of all column in matrix in c
- c switch
- read file in C
- sublime text
- find the largest number in else if javascript
- change custom post type icon
- diferencia entre * y & en c
- arduino ip to string
- markdown empty line
- c unused parameter
- hopw to check how many duplicates in an array c
- actionbar content color in android
- sidebar materializecss
- error: dereferencing pointer to incomplete type