Incrementing integer pointer will increase the address by size of integer.
What will happen if we increment a function pointer?
Incrementing integer pointer will increase the address by size of integer. What will happen
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Just as with
void *pointers and pointers to incomplete types, arithmetic is not allowed on pointers to functions.For example, C99 §6.5.6 on Additive operators says:
A function type is not an object type, so providing a pointer to a function as an operand of the
+operator is a violation of this constraint.As an extension to the C language, the GCC compiler allows arithmetic on pointers to functions (and pointers to
void). It implements this as if the pointed-to object had a size of 1. Note that in standards-conforming modes it issues a warning for such code.