hello guys, super noob here!
id want to build a function which is adding number in array, and if number is out of expect, its return to main,
else, it go to info_add function.
its work fine if i type less than 3.
...but seems like adding number isnt work at all. i tryed to tpey 2 and 2 again. My expect is: i[1]'s value is 4 and function will stop,
but value wasnt increase at all.
i looking for what is cause, and figured out this isnt work at all.
i[a] += b;
any help?
Thanks and happy holiday!
void info_add();
void menu_start();
void info_check();
static int b,d,i[3]={0,};
void main(){
info_check();
}
void info_check(){
....
printf("enter a number :");
scanf("%d", &a);
printf("enter b number :");
scanf("%d", &b);
printf("insert %d value in i[%d]\n",b,i[a]); //debug
i[a] += b;
if (i[a] > 3) {
printf("cant be add more than 3");
menu_start(); // returning to menu
}
else info_add();
}