[Updated] Goldman Sachs Aptitude Test Questions and Answers
Practice List of TCS Digital Coding Questions !!!
Take 50+ FREE!! Online Data Interpretation Mock test to crack any Exams.

C Programming :: Pointers - Discussion

Home > C Programming > Pointers > MCQs Questions Discussion

20 / 60

What is the output of the following C Program?

#include<stdio.h>
void main()
{
char *p = "program";
char c;
c = *(++p);
printf("%c",c); 
}

Ar

Bp

CSegmentation fault

DCompilation Error

ENone of these

Answer: Option (Login/Signup)

Show Explanation

since ,

c=*(++P);

is equivalent to 

1. p+=1;// first p will get incremented 

2. c=*p;//then the value present at the address stored in p will be assigned into c.

hence c will point to char 'r'.

Asked In ::

Post Your Answer Here:     

Reply    
Rate This: +0 -0
    Report


Report Error

Please Login First Click Here