Reputation: 91
I keep getting the error error: variable 'addresspic' set but not used
in the code below but I clearly use it.
Could somebody tell me if I am doing something wrong please?
I know that I should really be creating a pointer for addresspic
instead of casting the return value of get_pic()
but for now I can't understand why it is saying that the variable is not used.
//Function declaration
uint8_t* get_pic(int *piclen)
main() {
uint8_t addresspic;
unsigned int value;
addresspic = (uint8_t)get_pic((int*)& value);
}
Upvotes: 1
Views: 3194
Reputation: 45659
I guess the message isn't the most clear, but what it's telling you is that nothing reads the value form addresspic; so you assign to it (value set) but nothing depends on the value you set it to (not used).
Upvotes: 1