View Code of Problem 54

#include<stdio.h>
int main()
{
  int i,n;
  int a[100];  
  gets(a);
    if(a[i+1]!='\0')
      printf("%d ",&a[i]);
      printf("%d ",&a[i]);
    else 
 return 0;
}
/*
Main.c: In function 'main':
Main.c:6:3: warning: 'gets' is deprecated (declared at /usr/include/stdio.h:638) [-Wdeprecated-declarations]
   gets(a);
   ^
Main.c:6:8: warning: passing argument 1 of 'gets' from incompatible pointer type
   gets(a);
        ^
In file included from Main.c:1:0:
/usr/include/stdio.h:638:14: note: expected 'char *' but argument is of type 'int *'
 extern char *gets (char *__s) __wur __attribute_deprecated__;
              ^
Main.c:8:7: warning: format '%d' expects argument of type 'int', but argument 2 has type 'int *' [-Wformat=]
       printf("%d ",&a[i]);
       ^
Main.c:9:7: warning: format '%d' expects argument of type 'int', but argument 2 has type 'int *' [-Wformat=]
       printf("%d ",&a[i]);
       ^
Main.c:10:5: error: 'else' without a previous 'if'
     else 
     ^
Main.c:4:9: warning: unused variable 'n' [-Wunused-variable]
   int i,n;
         ^
*/

Double click to view unformatted code.


Back to problem 54