In C,
I have a doubt about Function pointers.
Lets say ,
typedef void (*test_audit_pr oc_t)( int *t, int index, int instnb);
typedef struct a_index
{
test_audit_proc _t test_mo_proc;
} test_audit_proc _index_t;
test_audit_proc _index_t t1[100];
Then
After filling t1[i].test_mo_proc = fn;
...
in another function
lets say
Sample 1:
void xyz()
{
test_audit_proc _t *proc;
*proc = t1[2].test_mo_proc ; -> Gives Sig 11 here
(*proc)(....... );
}
But if i give
Sample2 :
void xyz()
{
test_audit_proc _t proc;
proc = t1[2].test_mo_proc ; -> Gives Sig 11 here
(proc)(.......) ;
}
It works !!
But the same code with pointers (ie Sample 1) works for diff set of
function pointers
I just want to know how and why ???
I have a doubt about Function pointers.
Lets say ,
typedef void (*test_audit_pr oc_t)( int *t, int index, int instnb);
typedef struct a_index
{
test_audit_proc _t test_mo_proc;
} test_audit_proc _index_t;
test_audit_proc _index_t t1[100];
Then
After filling t1[i].test_mo_proc = fn;
...
in another function
lets say
Sample 1:
void xyz()
{
test_audit_proc _t *proc;
*proc = t1[2].test_mo_proc ; -> Gives Sig 11 here
(*proc)(....... );
}
But if i give
Sample2 :
void xyz()
{
test_audit_proc _t proc;
proc = t1[2].test_mo_proc ; -> Gives Sig 11 here
(proc)(.......) ;
}
It works !!
But the same code with pointers (ie Sample 1) works for diff set of
function pointers
I just want to know how and why ???