View Code of Problem 43

#include <stdio.h>
#include <string.h>
 
int main(){
  char buf[100];
  int i;
  gets(buf);
  for(i=0;i<strlen(buf);i++){
    if(ischar(buf[i])
       putchar(buf[i]);
    }
}
/*
Main.c: In function 'main':
Main.c:7:3: warning: 'gets' is deprecated (declared at /usr/include/stdio.h:638) [-Wdeprecated-declarations]
   gets(buf);
   ^
Main.c:9:5: warning: implicit declaration of function 'ischar' [-Wimplicit-function-declaration]
     if(ischar(buf[i])
     ^
Main.c:10:8: error: expected ')' before 'putchar'
        putchar(buf[i]);
        ^
Main.c:11:5: error: expected expression before '}' token
     }
     ^
*/

Double click to view unformatted code.


Back to problem 43