#include #include #include // ---------------------------------------------- // main function // ---------------------------------------------- int main() { int x, y; // str is NULL so it will be allocated by getline char *str = NULL; size_t size; // will read two integers followed by '\n' fscanf(stdin, "%d%d\n", &x, &y); printf("x = %d, y = %d\n", x, y); fflush(stdin); getline(&str, &size, stdin); fprintf(stderr, "str = [%s] of allocated size = %lu and real size %lu\n", str, size, strlen(str)); free(str); return 0; }