View Code of Problem 79

#include <stdio.h>
int main(){
  int n,i,m[10],p;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&m[i]);
  }
  scanf("%d",&p);
  for(i=0,j=m;i<m;i++,j--){
    b[i]=a[10-j];
  }
  for(i=m,j=0;i<n;i++,j++){
    b[i]=a[j];
  }
  for(i=0;i<n;i++){
    if(i<n-1){
      printf("%d ",b[i]);
    }else{
      printf("%d",b[i]);
    }
  }
  return 0;
}
/*
Main.c: In function 'main':
Main.c:9:11: error: 'j' undeclared (first use in this function)
   for(i=0,j=m;i<m;i++,j--){
           ^
Main.c:9:11: note: each undeclared identifier is reported only once for each function it appears in
Main.c:9:16: warning: comparison between pointer and integer
   for(i=0,j=m;i<m;i++,j--){
                ^
Main.c:10:5: error: 'b' undeclared (first use in this function)
     b[i]=a[10-j];
     ^
Main.c:10:10: error: 'a' undeclared (first use in this function)
     b[i]=a[10-j];
          ^
Main.c:12:8: warning: assignment makes integer from pointer without a cast
   for(i=m,j=0;i<n;i++,j++){
        ^
*/

Double click to view unformatted code.


Back to problem 79