char* ptr = "Rahul";
*ptr++;
printf("%s",ptr);


What will be the output

Answers were Sorted based on User's Feedback



char* ptr = "Rahul"; *ptr++; printf("%s",ptr); What will be the output..

Answer / vadivelt

Since address pointed by ptr got incremented, ptr will point to
address of char 'a'.

So o/p will be - ahul

Is This Answer Correct ?    73 Yes 5 No

char* ptr = "Rahul"; *ptr++; printf("%s",ptr); What will be the output..

Answer / praveen

ahul

Is This Answer Correct ?    26 Yes 4 No

char* ptr = "Rahul"; *ptr++; printf("%s",ptr); What will be the output..

Answer / sachin

ahul

Is This Answer Correct ?    13 Yes 0 No

char* ptr = "Rahul"; *ptr++; printf("%s",ptr); What will be the output..

Answer / amit

Ans: ahul


Reason:

Initially character pointer ptr pointed to the first character
of Rahul..when we increase it by increament operator it increase one byte.because size of character is one bye..
now it point to a..
we print from here
therefore we got above answer
so

Is This Answer Correct ?    9 Yes 0 No

char* ptr = "Rahul"; *ptr++; printf("%s",ptr); What will be the output..

Answer / sudeep dutta

Rahul loses his name and becomes ahul.

Is This Answer Correct ?    3 Yes 0 No

char* ptr = "Rahul"; *ptr++; printf("%s",ptr); What will be the output..

Answer / sunayana

the output is "ahul"

Is This Answer Correct ?    2 Yes 0 No

char* ptr = "Rahul"; *ptr++; printf("%s",ptr); What will be the output..

Answer / sayali

this code generates the output as,
ahul
but is also generate warning
that
code has no effect..

Is This Answer Correct ?    2 Yes 2 No

char* ptr = "Rahul"; *ptr++; printf("%s",ptr); What will be the output..

Answer / deepak

Ans:Sahul

Reason:
Intially *ptr contains ASCII value of 'R' on incrementing it
will points to ASCII value of 'S'.

Is This Answer Correct ?    2 Yes 15 No

char* ptr = "Rahul"; *ptr++; printf("%s",ptr); What will be the output..

Answer / darshan

Rahul

Is This Answer Correct ?    4 Yes 18 No

Post New Answer

More OOPS Interview Questions

What is multidimensional array?

1 Answers  


What is class and example?

0 Answers  


what is the size of an empty class

12 Answers   Wipro,


what are the ways in which a constructors can be called?

2 Answers   TCS,


What does <> mean pseudocode?

0 Answers  






Following are the class specifications: class {int a}; class {int b}; Using friend funtion,calculate the max of two objects and display it.

0 Answers  


c++ provides classes...and classes do what we want but why then strcut are used...if we say data hiding... it is also provided by c++ in structs then why to prefer clasess

1 Answers   HCL, TCS,


What is methods in oop?

0 Answers  


How many types of access specifier in c# and vb.net?

1 Answers   Infosys,


What are the OOPS concepts?

106 Answers   A1 Technology, Bajaj, CTS, EDS, HP, Infosys, Intel, Microsoft, MNC, Persistent, PlanetSoft, ProConstructor, TCS, Virtusa, Wipro, YSoft Solutions,


What is the main feature of oop?

0 Answers  


inheritence with example

1 Answers  


Categories