#include<stdio.h> int main() { int i,n;int a[10]; int temp1,temp2; int min=0,max=0; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d",&a[i]); } for(i=0;i<n;i++) { if(a[i]<a[min]) min=i; } temp1=a[0];a[0]=a[min];a[min]=temp; for(i=0;i<n;i++) { if(a[i]>a[max]) max=i; } temp2=a[n-1];a[n-1]=a[max];a[max]=temp2; for(i=0;i<n-1;i++) { printf("%d ",a[i]); } printf("%d\n",a[n-1]); return 0; } /* Main.c: In function 'main': Main.c:17:33: error: 'temp' undeclared (first use in this function); did you mean 'temp2'? temp1=a[0];a[0]=a[min];a[min]=temp; ^~~~ temp2 Main.c:17:33: note: each undeclared identifier is reported only once for each function it appears in Main.c:5:7: warning: variable 'temp1' set but not used [-Wunused-but-set-variable] int temp1,temp2; ^~~~~ */ |
Double click to view unformatted code.