看不懂的c
<---------------------------------------file1----------------------------------------------------------------------------->#include<stdio.h>
#include"one1.c"
int main(){
int * arrs,j;
arrs = one1(6);
for(j=0;j<6;j++){
printf("\t%d",*(arrs++));
};
}
<---------------------------------------file2----------------------------------------------------------------------------->
int * one1(int i){
int *jj, j,k[i];
for(j=0;j<i;j++){
k[j]=6-j;
}
for(j=0;j<i;j++){
printf("%d;;;",k[j]);
};
jj=k;
return jj;
}
结果:6;;;5;;;4;;;3;;;2;;;1;;; 6 5 4 3 2 1
<---------------------------------------修改file2----------------------------------------------------------------------------->
int * one1(int i){
int *jj, j,k[i];
for(j=0;j<i;j++){
k[j]=6-j;
}
for(j=0;j<i;j++){
// printf("%d;;;",k[j]);[/color]
};
jj=k;
return jj;
}
结果:6 5 8959252 -1216031792 2 -1
为什么会这样呢!!!!!!!
为什么会这样呢!!!!!!!