Horje
how to store a user input with spaces in c Code Example
how to store a user input with spaces in 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;
}
how to store a user input with spaces in c
#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;




C

Related
how to make a hello world program in c Code Example how to make a hello world program in c Code Example
check dns server in linux Code Example check dns server in linux Code Example
c include uint8_t Code Example c include uint8_t Code Example
remix icon cdn Code Example remix icon cdn Code Example
terminal count files in directory Code Example terminal count files in directory Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
13