This repository has been archived on 2023-10-26. You can view files and clone it, but cannot push or open issues or pull requests.
VSMechatronics/LC7/FgetsString/fgets_string.c

23 lines
397 B
C
Raw Normal View History

2022-04-07 15:58:01 +00:00
/* EEEE1001/H61CAE*/
/* A program to show how to use fgets to safely read in a string */
#include <stdlib.h>
#include <stdio.h>
int main()
{
char MyName[11]; /* Define a string of 10 characters */
2022-04-07 15:58:01 +00:00
/* A string */
printf("\nPlease enter your name & press return ");
fgets(MyName, 11, stdin);
2022-04-07 15:58:01 +00:00
printf("\nHello %s ",MyName);
return 0; /* End of the program */
}