C Basic 52: Input using fgets()

4 January 2020, 11:18 pm by antelove19

C programming language

C programming language



Happy Coding


main.c

/* ------------------------------------------------------------ */
/*  Input                                                       */
/*  Using fgets()                                               */
/*                                                              */
/*  Author: antelove                                            */
/*  Website: antelove.com                                       */
/* ------------------------------------------------------------ */

#include <stdio.h>

int main() {

    char input[64]; // 63 characters plus null

    printf("What is your name (with white-space and max 63 character): \n");
    fgets(input, 64, stdin); // input

    printf("Your name is %s \n", input);

    getchar();

    return 0;

}

Thank for reading :)



No Action Title
1 Live
2 Editor
0 comment