Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

'gets is unsafe'

Name: Anonymous 2013-01-16 1:18

You're just using it incorrectly, you dumb kid.

#include <stdio.h>

int main(void)
{
    char uranus[2];
    int c;

    while ((c = getchar()) != EOF)
        if (c == '\n') {
            ungetc(c, stdin);
            gets(uranus);
        }
    return 0;
}

Name: Anonymous 2013-01-16 6:27

uranus is not big enough, may cause buffer owerrun. Try saturn or even jupiter if you have enough space.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List