H Huyền Thu New member Sep 18, 2021 #1 What will be the output of the following C++ code? Code: #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
What will be the output of the following C++ code? Code: #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
I Ivanesn New member Sep 18, 2021 #2 Answer: a Explanation: Pointer ptr points to string 'fg'. So it prints fg. Output: Code: $ g++ point.cpp $ a.out fg Upvote 0 Downvote
Answer: a Explanation: Pointer ptr points to string 'fg'. So it prints fg. Output: Code: $ g++ point.cpp $ a.out fg