View Code of Problem 54

#include<stdio.h>
#include<string.h>
int main()
{
  char shr[100];
  gets(str);
  int i=0;
  len=strlen(str);
  while(str[i]!='\0')
  {
    printf("%c",str[i]);
    if(str[i+1]!='\0')
      printf(" ");
    ++i;
  }
}
/*
Main.c: In function 'main':
Main.c:6:3: warning: 'gets' is deprecated (declared at /usr/include/stdio.h:638) [-Wdeprecated-declarations]
   gets(str);
   ^
Main.c:6:8: error: 'str' undeclared (first use in this function)
   gets(str);
        ^
Main.c:6:8: note: each undeclared identifier is reported only once for each function it appears in
Main.c:8:3: error: 'len' undeclared (first use in this function)
   len=strlen(str);
   ^
Main.c:5:8: warning: unused variable 'shr' [-Wunused-variable]
   char shr[100];
        ^
*/

Double click to view unformatted code.


Back to problem 54