Hi,
I have a pointer which points to a function. I would like to:
if (mode == 0)
{
const unsigned char *packet = read_serial_packet(src, &len);
} else {
const unsigned char *packet = read_network_packet(fd, &len);
}
But I cannot do it because my compiler complains when I first use the pointer later in the code.
error: 'packet' undeclared (first use in this function)
This is strange. It worked without the if statement, but now I need my program to be able to get data from different sources. Isn't it possible to do this? I think so. If it isn't, is there any other simple way to get what I am trying?
Thanks a lot.