Search:

Type: Posts; User: matsp

Search: Search took 0.03 seconds.

  1. Replies
    10
    Views
    43,999

    Good suggestion ;) -- Mats

    Good suggestion ;)

    --
    Mats
  2. Replies
    10
    Views
    43,999

    Yes, but that leaves the newline in the input...

    Yes, but that leaves the newline in the input buffer, which CAN lead to difficulties elsewhere - so we then ALSO need to write code to find out if there is a newline in the string or not, and if not...
  3. Replies
    10
    Views
    43,999

    char word[15]; fgets(word,16,stdin); You...

    char word[15];
    fgets(word,16,stdin);

    You should NOT lie to fgets() as to the length of your buffer. It's best to use sizeof() rather than a constant, that way, if you change the variable itself,...
  4. Replies
    10
    Views
    43,999

    scanf("%c"..) leaves a "newline" in the input...

    scanf("%c"..) leaves a "newline" in the input buffer, so you get an empty line from fgets(), since it reads everything up to the next newline. Add a space after the format of scanf, e.g. scanf("%c...
Results 1 to 4 of 4