main()
{
int arr[]={12,14,16,18,20}
printf("%u%u";arr+1,&arr+1);
}
//tell me the answer of this question with proper reason..:)//
Answer / rpr
The correct question should be:
main()
{
int arr[]={12,14,16,18,20};
printf("%u%u",arr+1,&arr+1);
}
there are two different notations:
arr+1 and &arr+1;
arr is same as &arr[0] - location of arr[0], first element
arr+1 is same as &arr[1] - location of arr[1]
arr+2 is same as &arr[2] - location of arr[2]
and so on...
here if address of arr is 6524 then address of arr+1 is
6526, address of arr+2 is 6528.. as arr is of int type so a
difference of two.
now about &arr
it represents the location of entire array.
so it will gives address of first element of array.
when 1 is added to it, the size of array is added to it..
example..
if the address of first element,arr[0] is 6524
and the size of array is-
-(no. of elements)*(size of each element)
here 5*2=10
then,
&arr = 6524
&arr+1 = 6524+(1*size of array)=6524+(1*10)=6534
&arr+2 = 6524+(2*10)=6544
and so on..
one more point:
as here notations are behaving in a pointer manner(actually
reference).. you should know pointer saves values in
unsigned int- from 0-65535
..
once the value of pointer reaches 65535, it comes back to 0.
-rpr..ravidasonline@gmail.com
| Is This Answer Correct ? | 1 Yes | 0 No |
write a c program which accept input as:Anu.B.Kapur and give out as:Kapur.A.B using pointers
how 2 write a program of this pattern usin for loop?? 1 2 3 4 5 6 7 8 9 10
How much engineering percentage is required to get admission in MS (USA)
Who secured the first hat trick in the 20 - 20 match ? a) symond b)balaji c) muthaiya muralidharan
what is fabrication process?
assemblies in .net
Can anyone tell me the exact formulae with explanation for the questions related to cube which is asked for CTS? I have seen varieties of formulae in different sites.I need the exact on... So pls help me out!!!
What is a computer without a hard disk called as technically ?
an upper layer message is split into 10 frames each of which has an 80 percent chance of arriving undamaged.if no error control is done by the data link protocol,how many times must the message be sent on the average to get the entire thing through?
WAP in Java to print the format: ABC BCD CDE EFG
How many rounds in dell interview process in dell
2 Answers DELL, IBM, Marvel ERP,
What is the difference between tcp/ip protocol and IP protocol?
2 Answers CMC, CMS, Microsoft,
Civil Engineering (5086)
Mechanical Engineering (4456)
Electrical Engineering (16639)
Electronics Communications (3918)
Chemical Engineering (1095)
Aeronautical Engineering (239)
Bio Engineering (96)
Metallurgy (361)
Industrial Engineering (259)
Instrumentation (3014)
Automobile Engineering (332)
Mechatronics Engineering (97)
Marine Engineering (124)
Power Plant Engineering (172)
Textile Engineering (575)
Production Engineering (25)
Satellite Systems Engineering (106)
Engineering AllOther (1379)