"Hello World!" in C

  • + 28 comments

    gets is deprecated for security reasons, because it can't protect against a buffer overflow. Man page says "Never use this function." fgets is recommended instead.

    So I used:

    int main ()
    {
    	char s[100];
    	fgets(s, sizeof(s), stdin);
    	printf("Hello, World!\n%s", s);
    	
    	return 0;
    }