Sail E0 Webinar
Question

What is the output of this program?

#include < iostream >

using namespace std;

int main()

{

char *ptr;

char Str[] = "abcdefg";

ptr = Str;

ptr += 5;

cout

Options:
A .  fg
B .  cdef
C .  defg
D .  abcd
Answer: Option A


Pointer ptr points to string 'fg'. So it prints fg.



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers