void func1(void)
{
strans obj;\\\\struct
unsigned int i,ix;
ix=1;
if (a>0)\\\\\\\\\\ \\\a is global int
ix=a;
for (i=ix;i<5;i++)
{
func2(i,obj);
\\\\\\\\\\\\\\\ \\\\\\\i value here i =1 ok
func3(obj);
\\\\\\\\\\\\\\\ \\\\\\\ func3 ok
\\\\\\\\\\\\\bu t after this func3 call i value===0\\\\\e rror
\\not making any change to or passing address of i in func3 but still getting \\reset
\\if i use static for i variable it works correctly
\\but scope of i even though local is through out function1 is it not?
\\please tell me why this problem occurs..
}
}
could it be a stack problem were i is lost when func3 is called ,,isnt static used the other way around to retain i value when flow exits out of func1..thankyou for all posts
{
strans obj;\\\\struct
unsigned int i,ix;
ix=1;
if (a>0)\\\\\\\\\\ \\\a is global int
ix=a;
for (i=ix;i<5;i++)
{
func2(i,obj);
\\\\\\\\\\\\\\\ \\\\\\\i value here i =1 ok
func3(obj);
\\\\\\\\\\\\\\\ \\\\\\\ func3 ok
\\\\\\\\\\\\\bu t after this func3 call i value===0\\\\\e rror
\\not making any change to or passing address of i in func3 but still getting \\reset
\\if i use static for i variable it works correctly
\\but scope of i even though local is through out function1 is it not?
\\please tell me why this problem occurs..
}
}
could it be a stack problem were i is lost when func3 is called ,,isnt static used the other way around to retain i value when flow exits out of func1..thankyou for all posts
Comment