G
Giannis Papadopoulos
I have the following code
#include <stdio.h>
void a(void) {
printf("a called.\n");
}
int b(void) {
printf("b called.\n");
return 0x1;
}
int main(void) {
void (*p)(void);
p = a;
p();
p = b;
p();
return 0;
}
However, it does issue a warning that I am trying to assign a function
of wrong type. Is there any portable way to say to the compiler "shut
up, I know what I am doing?"
And what is the most common way of declaring and using function
pointers, the above or this?
p = &a;
(*p)();
--
one's freedom stops where others' begin
Giannis Papadopoulos
http://dop.users.uth.gr/
University of Thessaly
Computer & Communications Engineering dept.
#include <stdio.h>
void a(void) {
printf("a called.\n");
}
int b(void) {
printf("b called.\n");
return 0x1;
}
int main(void) {
void (*p)(void);
p = a;
p();
p = b;
p();
return 0;
}
However, it does issue a warning that I am trying to assign a function
of wrong type. Is there any portable way to say to the compiler "shut
up, I know what I am doing?"
And what is the most common way of declaring and using function
pointers, the above or this?
p = &a;
(*p)();
--
one's freedom stops where others' begin
Giannis Papadopoulos
http://dop.users.uth.gr/
University of Thessaly
Computer & Communications Engineering dept.