Give a personalized hello
This commit is contained in:
7
main.c
7
main.c
@@ -1,6 +1,11 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
printf("Hello world!\n");
|
||||
char name[255];
|
||||
printf("Enter your name: ");
|
||||
fgets(name, 255, stdin);
|
||||
name[strlen(name)-1] = '\0'; /* remove the newline at the end */
|
||||
printf("Hello %s!\n", name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user