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]))
     ^
/tmp/cc9MQ2eE.o: In function `main':
Main.c:(.text+0x11): warning: the `gets' function is dangerous and should not be used.
Main.c:(.text+0x33): undefined reference to `ischar'
collect2: error: ld returned 1 exit status
*/

Double click to view unformatted code.


Back to problem 43