#include <iostream> using namespace std; int main() { char *ptr; char Str[] = "abcdefg"; ptr = Str; ptr += 5; cout << ptr; return 0; }
a) fg
b) cdef
c) defg
d) abcd
#include <iostream> using namespace std; int main() { char *ptr; char Str[] = "abcdefg"; ptr = Str; ptr += 5; cout << ptr; return 0; }
a) fg
b) cdef
c) defg
d) abcd
You must be logged in to post a comment.
a
Explanation: Pointer ptr points to string ‘fg’. So it prints fg.
Output:
$ g++ point.cpp
$ a.out
fg