(See section 3.12 in 2nd ed. or section 3.13 in 1st ed.)
What does this function do?
It appears to
- Read an input line from the user.
- Print 1 regardless of the user input.
But there is a problem with the character array that holds the user input!
1 #include <stdio.h> 2 #include <stdlib.h> 3 4 int getbuf() 5 { 6 char buf[12]; 7 getxs(buf); 8 return 1; 9 } 10 11 int main() 12 { 13 int val; 14 val = getbuf(); 15 printf("getbuf returned 0x%08x\n", val); 16 17 return 0; 18 }