536 views
0 votes
0 votes

How to calculate the sizeof(arr2)?

2 Answers

2 votes
2 votes

The sizeof( ) operator in C/C++  is used to find the memory its operand occupies in the computer’s memory.Sizeof is an unary operator. sizeof - Wikipedia

Now sizeof(arr2) will return the memory pointer arr2 occupies in your computer’s memory. arr2 is a pointer to an integer array. So arr2 will need space to store the base address of the integer array(here this array also contains some address which are r1 and r2) for which 8 bytes will be allocated in 64 bit system and 4 bytes will be allocated in 32 bit system.So the o/p depends on machine.

Related questions

0 votes
0 votes
0 answers
1
SKMAKM asked Oct 22, 2022
435 views
Answer -3.7
0 votes
0 votes
0 answers
2
SKMAKM asked Oct 20, 2022
529 views
Answer 3.12
1 votes
1 votes
2 answers
4