Question
1.
#include
2.
using namespace std;
3.
int main()
4.
{
5.
char *ptr;
6.
char Str[] = "abcdefg";
7.
ptr = Str;
8.
ptr += 5;
9.
cout
What is the output of this program?
1.
#include
2.
using namespace std;
3.
int main()
4.
{
5.
char *ptr;
6.
char Str[] = "abcdefg";
7.
ptr = Str;
8.
ptr += 5;
9.
cout
Answer: Option A
Was this answer helpful ?
Pointer ptr points to string ‘fg’. So it prints fg.
Output:
$ g++ point.cpp
$ a.out
fg
Was this answer helpful ?
More Questions on This Topic :
Question 5.
Which of the following is illegal?
....
Question 6.
Choose the right option string* x, y;
....
Submit Solution