mystrio.c (698B)
1 /* Exercise 8.29 */ 2 3 /* This exercise don't have any sense! */ 4 5 int getchar(void); 6 char *gets(char *s); 7 int putchar(int c); 8 int puts(const char *s); 9 10 int main(void) 11 { 12 char c, str[10]; 13 14 printf("Give me a char: "); 15 c = getchar(); 16 17 printf("\nputchar(): %c\n", putchar(c)); 18 19 printf("Give me a string: "); 20 gets(str); 21 22 printf("puts(): "); 23 puts(str); 24 25 printf("\n"); 26 27 return 0; 28 } /* E0F main */ 29 30 int getchar(void) 31 { 32 char c; 33 scanf("%c", &c); 34 return c; 35 } 36 37 char *gets(char *s) 38 { 39 scanf("%s", s); 40 return s; 41 } 42 43 int putchar(int c) 44 { 45 printf("%c", c); 46 return c; 47 } 48 49 int puts(const char *s) 50 { 51 printf("%s", s); 52 53 if(*s != '\0') 54 return 1; 55 56 return -1; 57 } 58