Fill in the blank? In C program | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Fill in the blank? In C program

The integer element of an array address start from 3000. If size of each element is 4 bytes then what would be the address stored in vPtr after the following operation? Int v[4]={32,64,87,65}; Int *vPtr; vPtr = &v[0]; vPtr+=4;

29th Jun 2020, 5:21 AM
Faisal Iqbal
Faisal Iqbal - avatar
2 Answers
+ 1
1.) int v[4]={32,64,87,65}; 2.) int *vPtr; 3.) vPtr = &v[0]; 4.) vPtr+=4; At 2nd step , vPtr value will be 3000 according to you At 4th step,the vPtr value will 3000+(4*4) = 3016 Address value ---------------- 3000 32 3004 64 3008 87 3012 65 3016 garbage value
29th Jun 2020, 7:52 AM
Nikhil Maroju
Nikhil Maroju - avatar
+ 2
Yeah your right!! Nikhil Maroju
29th Jun 2020, 9:18 AM
_sAi_.ExE
_sAi_.ExE - avatar