S
sam_cit
Hi Everyone,
I just saw in a site, http://www.newty.de/fpt/intro.html, that
function pointers can be used for all functions having same singnature
(parameter type(sS) and return type), and i tried the following code
and it worked fine although the return type was different for the two
functions,
int func1()
{
printf("in func1...\n");
return(1);
}
char func2()
{
printf("in func2...\n");
return('c');
}
int main()
{
int (*p)();
p = &func1;
p();
p = &func2;
p();
}
i tried in Microsoft VC++ 6.0, is it an undefined behavior? Please let
me know...
I just saw in a site, http://www.newty.de/fpt/intro.html, that
function pointers can be used for all functions having same singnature
(parameter type(sS) and return type), and i tried the following code
and it worked fine although the return type was different for the two
functions,
int func1()
{
printf("in func1...\n");
return(1);
}
char func2()
{
printf("in func2...\n");
return('c');
}
int main()
{
int (*p)();
p = &func1;
p();
p = &func2;
p();
}
i tried in Microsoft VC++ 6.0, is it an undefined behavior? Please let
me know...