+ 2
focus on programming... what is the problem of this code?
short *numPtr, result; void* genericPtr = numPtr; result = *genericPtr + 7;
1 Resposta
0
First problem is trying to invoke the + operator on a void (*genericPtr), which doesn't support it. Second problem is that even if you would statically cast it back to short to support that operation, it has been initialized with an undefined address value (because numPtr has not been initialized at all). Using a undefined zone of memory would likely yield a segmentation fault or a totally random value for your short. PS: sorry for my English.