I have a file where I have two functions, function1 and function2.
Both these files are called from the main script.
I have a structure pre_block ppp:
Code:
struct pre_block {
int *blk;
int no_blk;
};
The structure is declared in the main funciton .
It is then initialised, assigned memory, in function1, and called by:
Code:
function1(var1,&var2,...,&ppp)
Within function1, I first set
then afterwards in the same function it increments through a loop and is
PHP Code:
ppp->no_blk=50;
However, in the main function and in function2 which is later called as:
Code:
function2(&var5,&var6,var7,...&ppp)
, I get that ppp->no_blk=0 and not 50.
I have done it similarly with passing variable by pointer with another structure in another function,and there it worked, so I don't understand what I am doing wrong here.
Also, when I set ppp->no_blk=0; at the very beginning of the function, it gets some very large value after incrementations which I assum e is the addres.
And when i set ppp->no_blk=0; later in the function1, just before starting incrementation, then it is 50 within function1 and in the main script and function2 it is as described above.
Hope I have asked the question clearly enough!