QA – Placement Quizzes | SP Contest 2 | Question 9
What will be the output of the below C++ program?
#include<iostream> using namespace std; int main() { int a[] = {10,20,30,40,50}; cout<<(*(&a+1)-a); return 0; } |
(A) 10
(B) 0x7ffc7185f754
(C) 50
(D) 5
Answer: (D)
Explanation: Refer to method 2 of this post: https://www.geeksforgeeks.org/how-to-find-size-of-array-in-cc-without-using-sizeof-operator/
Quiz of this Question
Please comment below if you find anything wrong in the above post
Please Login to comment...