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..:)//



main() { int arr[]={12,14,16,18,20} printf("%u%u";arr+1,&arr+1); } //tell me the..

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

Post New Answer

More Engineering AllOther Interview Questions

what should be the finish work of a carpenter per day

0 Answers  


What is the dewpoint of atmoshperic Air?

0 Answers  


can you justify your answer regarding output of following source-code: #include<stdio.h> #include<conio.h> void main() { clrscr(); if(printf("");) { printf("i am able to work in your company :"); } else { printf("your company is not able for having my knowledge :") } getch(); }

1 Answers   Wipro,


what is the difference between BE and BTECH??

1 Answers   Wipro,


what is SOA in DNS

1 Answers   NetMagic,






There are prime factors of two numbers a and b , write a program using this prime factors whether a is divisible by b?

0 Answers  


Explain a situation in which you handled a customer?s questions or problems?

0 Answers   Kplus Infotech,


what in 4th and 5th normal form ??

0 Answers  


what are the examples of E-Based Applications?

1 Answers  


I have cleared SBT clerk exam and having interview on 29.I have completed my B.tech in IT.I would like to know the types of questions asked in the interview.

0 Answers  


plz explain abt refrigeration r22 bitzer comprassors trouble shooting and maintenance

0 Answers  


Box 1 cotain odd value X or Y the box 2 =X i.e 7 or 12 box 3= Y has value 19 if X is 7 or 31 if x is 12 get even value X or Y Use any operator steps allowed 3.

0 Answers  


Categories
  • Civil Engineering Interview Questions Civil Engineering (5085)
  • Mechanical Engineering Interview Questions Mechanical Engineering (4451)
  • Electrical Engineering Interview Questions Electrical Engineering (16632)
  • Electronics Communications Interview Questions Electronics Communications (3918)
  • Chemical Engineering Interview Questions Chemical Engineering (1095)
  • Aeronautical Engineering Interview Questions Aeronautical Engineering (239)
  • Bio Engineering Interview Questions Bio Engineering (96)
  • Metallurgy Interview Questions Metallurgy (361)
  • Industrial Engineering Interview Questions Industrial Engineering (259)
  • Instrumentation Interview Questions Instrumentation (3014)
  • Automobile Engineering Interview Questions Automobile Engineering (332)
  • Mechatronics Engineering Interview Questions Mechatronics Engineering (97)
  • Marine Engineering Interview Questions Marine Engineering (124)
  • Power Plant Engineering Interview Questions Power Plant Engineering (172)
  • Textile Engineering Interview Questions Textile Engineering (575)
  • Production Engineering Interview Questions Production Engineering (25)
  • Satellite Systems Engineering Interview Questions Satellite Systems Engineering (106)
  • Engineering AllOther Interview Questions Engineering AllOther (1379)