C Programming :: Declarations and Initializations - Discussion
3 / 54
#include<stdio.h>
int main() {
{
int const * p=5;
printf("%d",++(*p));
return 0;
}
#include<stdio.h>
int main() {
{
int const * p=5;
printf("%d",++(*p));
return 0;
}
ACompiler error
B5
C6
DNone of these
Show Explanation
Asked In ::
It will give only warning not an error. But it is giving error because there are two parenthesis after main().
Read Full Answer
Report Error
Please Login First Click Here
The correct answer will be option A. Here *p is a pointer to an integer which is also declared as constant using the keyword 'const', so we cannot update its value further as its is declared as const.
Read Full Answer
Report Error
Please Login First Click Here
*p denotes a pointer. In the code it is declared as constant pointer to an integer. Hence constant values cant be changed so (*p) is not possible hence its showing compiler error.
Read Full Answer
Report Error
Please Login First Click Here