Browse Source

moved character definition into while loop

master
T. Meissner 11 years ago
parent
commit
29b41b440a
1 changed files with 1 additions and 2 deletions
  1. +1
    -2
      c_pointers/getline.c

+ 1
- 2
c_pointers/getline.c View File

@ -14,14 +14,13 @@ char *getLine(void) {
char *currentPosition = buffer; char *currentPosition = buffer;
size_t maximumLength = sizeIncrement; size_t maximumLength = sizeIncrement;
size_t length = 0; size_t length = 0;
int character;
if (currentPosition == NULL) { if (currentPosition == NULL) {
return NULL; return NULL;
} }
while (1) { while (1) {
character =fgetc(stdin);
int character =fgetc(stdin);
if (character == '\n') { if (character == '\n') {
break; break;
} }


Loading…
Cancel
Save