No.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_BUFF 100
#define NCHAR_PER 4
int main(int argc, char *argv[])
{
char s[MAX_BUFF];
char * result;
result = fgets(s, NCHAR_PER, stdin);
if (result == NULL) {
return EXIT_FAILURE;
}
else {
fprintf(stdout, "strlen(s) = %u s = %s\n", strlen(s), s);
result = fgets(s, NCHAR_PER, stdin);
if (result == NULL) {
return EXIT_FAILURE;
}
else {
fprintf(stdout, "strlen(s) = %u s = %s\n", strlen(s), s);
}
}
return EXIT_SUCCESS;
}
With an input of:
abc\n
will have return with the string of
Code:
{'a', 'b', 'c', '\0'}
on the first call
and a string of on the second call.