C - Write program to read string with fgets() function from console window

Requirements

Write program to read string with fgets() function from console window

Demo

#include <stdio.h>

int main()/* w  ww  . j av a2 s .  c  om*/
{
    char firstname[16];

    printf("What is your name? ");
    fgets(firstname,16,stdin);
    printf("Pleased to meet you, %s\n",firstname);
    return(0);
}

Result

Related Example