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 Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

why does a microprocessor generally hAVE more address lines than data lines?

1459


hi... i just want to know that how could join the AAI with an B.E back ground??? please help me out.

1582


write a progremme using function 0f prime no.?

1393


Do you have any tips for using 3G phones?

1438


what do you mean by a p-code?

1473






i am satish i want to preapare for group-1 exams so please help me?

1549


What are the differences between 1 dimensional RAM and 2 dimensional RAM?

2191


what is difference between value datatype and object datattype

1393


How can we share data between actions in qtp..pls tell me

1796


Is there any difference between the concepts of encoding,decoding and encryption and decryption?

1610


if u have question papers/sample papers of any of PSUs,plz send me at dinesh.pandey3@gmail.com

1528


Write a program in ā€˜Cā€™ language that will perform the following operation on static stack. 1. push 2. pop 3. Display 4. Exit Create separate functions for each operation. The push() should accept one argument of structure type and will not return any thing. The pop() function will not receive any argument & return structure type value. The stack & top must be declare as external variable. Each element of stack will contain the following information Roll No, Std Name, Course. Use do-while loop & switch case for generating the above menu. The format of the output should is given below: S.No. Roll No. Student Name Course 1 cse01 Anil Singh B.Tech

1492


Explain how to share outlook calenders and the type of permissions you need to assign?

1665


can any give an exact example about, resolving the sql errorcode -305

1460


i am shortlisted in corporation bank for the post of computer officer the next phase is group discussion. i want to know how to prepare and what about the topics for preparing thanking you if you have any suggestion please give me prabhatmishra21@rediffmail.com

2123