Get Input String From Keyboard

Saturday, October 3, 2009

Now, we'll show how to get input string from keyboard using C. This is the example:

/* Example using gets() and scanf() to input string.
*/
#include<stdio.h>

int main(void){
    char name[15];

    printf("Insert Your name please: ");
    gets(name);
    // or scanf("%s", name);

    printf("Halo, %s. Happy enjoying C. \n", name);
}




And this is the result:


0 comments:

Post a Comment

 
 
Copyright © Welcome