Hello.,
Have a question about array being set from function argument. I wrote this little program, and want to know why cant i set an array size from the function argument. Any help would be greatly appreciated.
int money(int deposit, ...){
int
i,
sum = 0,
nextvar;
// myArr[deposit]; // < -- in here i cant set the array size from function receiving argument? and why?
va_list
parg;
va_start(parg, deposit);
for(i=0;i<deposit;i++){
nextvar=va_arg(parg, int);
// myArr[i]=nextvar;
sum+=nextvar;
}
va_end(parg);
return sum/deposit;
}
int main(void){
printf("%d", money(4,4,4,4,4));
getchar();
return 0;
}
---
Andre Granovsky