#include <stdio.h>
int main(){
char name[20];
printf("Enter a name : ");
scanf("%[^
]%*c", &name);
printf("the name entered is: %s
", 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
", name);
return 0;
Code Example |
---|
C :: random number between 2 in C |
C :: c check if file exists |
C :: get file extension from base64 string |
C :: factorial in c |
C :: convert from integer to string vb |
C :: read files in c |
C :: c random list |
C :: C overwrite last line |
C :: printf with bool |
C :: Numeri in ordine crescente C |
C :: c how to get an integer from user input |
C :: see if two strings are equal in C |
C :: how to shutdown system c++ |
C :: factorial in c using recursion |
C :: strcasecmp in c |
C :: c bit access union |
C :: hi servicenow |
C :: c static variables |
C :: How to change an array in a function in c |
C :: c program to find the factorial of a number |
C :: factorial of a number in c |
C :: c code to add two numbers |
C :: C Arithmetic Operators |
C :: how to reset all values of 2d vector to 0 |
C :: c program that replace vowels in a string with char |
C :: sort names in array in c |
C :: declare string in c |
C :: #define f_cpu |
C :: declaration in c |
C :: print in c |