void main()

{

int const * p=5;

printf("%d",++(*p));

}

Answers were Sorted based on User's Feedback



void main() { int const * p=5; printf("%d",++(*p)); }..

Answer / susie

Answer :

Compiler error: Cannot modify a constant value.

Explanation:

p is a pointer to a "constant integer". But we
tried to change the value of the "constant integer".

Is This Answer Correct ?    78 Yes 10 No

void main() { int const * p=5; printf("%d",++(*p)); }..

Answer / mahe

5
pointer value does not change.so print thier value

Is This Answer Correct ?    3 Yes 8 No

void main() { int const * p=5; printf("%d",++(*p)); }..

Answer / jambalakadi pamba

here...p is a pointer which is pointing to a addresss which is constant....!!! so the output is 6

Is This Answer Correct ?    8 Yes 22 No

Post New Answer

More C Code Interview Questions

main() { int i=5; printf("%d%d%d%d%d%d",i++,i--,++i,--i,i); }

7 Answers  


void main() { int const * p=5; printf("%d",++(*p)); }

3 Answers   Infosys, Made Easy, State Bank Of India SBI,


const int perplexed = 2; #define perplexed 3 main() { #ifdef perplexed #undef perplexed #define perplexed 4 #endif printf("%d",perplexed); } a. 0 b. 2 c. 4 d. none of the above

1 Answers   emc2, HCL,


Sorting entire link list using selection sort and insertion sort and calculating their time complexity

1 Answers   Infosys, Microsoft, NetApp,


write a c program to Reverse a given string using string function and also without string function

1 Answers  






WAP to display 1,2,3,4,5........N

2 Answers  


main() { int i = 0xff ; printf("\n%d", i<<2); } a. 4 b. 512 c. 1020 d. 1024

2 Answers   HCL,


Write a function to find the depth of a binary tree.

13 Answers   Adobe, Amazon, EFI, Imagination Technologies,


main() { int i, j; scanf("%d %d"+scanf("%d %d", &i, &j)); printf("%d %d", i, j); } a. Runtime error. b. 0, 0 c. Compile error d. the first two values entered by the user

2 Answers   HCL,


main() { char *p; p="Hello"; printf("%c\n",*&*p); }

1 Answers  


#define assert(cond) if(!(cond)) \ (fprintf(stderr, "assertion failed: %s, file %s, line %d \n",#cond,\ __FILE__,__LINE__), abort()) void main() { int i = 10; if(i==0) assert(i < 100); else printf("This statement becomes else for if in assert macro"); }

1 Answers  


main() { int i=0; for(;i++;printf("%d",i)) ; printf("%d",i); }

1 Answers   Zoho,


Categories