Give a personalized hello
This commit is contained in:
1 parent
e9a41100a0
commit
ec2323c0c3
1 file changed
+6
-1
@@ -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