C Basic 51: Input using scanf()

4 January 2020, 11:15 pm by antelove19

C programming language

C programming language



Happy Coding


main.c


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

#include <stdio.h> // standar input output library

int main() {

    char input[11]; // 10 characters plus null

    printf("What is your name (without white-space and max 10 character): \n");
    scanf("%s", &input);

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

    getchar(); // hold the screen

    return 0;

}

Thank for reading :)



No Action Title
1 Live
2 Editor
0 comment