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
why does a microprocessor generally hAVE more address lines than data lines?
hi... i just want to know that how could join the AAI with an B.E back ground??? please help me out.
write a progremme using function 0f prime no.?
Do you have any tips for using 3G phones?
what do you mean by a p-code?
i am satish i want to preapare for group-1 exams so please help me?
What are the differences between 1 dimensional RAM and 2 dimensional RAM?
what is difference between value datatype and object datattype
How can we share data between actions in qtp..pls tell me
Is there any difference between the concepts of encoding,decoding and encryption and decryption?
if u have question papers/sample papers of any of PSUs,plz send me at dinesh.pandey3@gmail.com
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
Explain how to share outlook calenders and the type of permissions you need to assign?
can any give an exact example about, resolving the sql errorcode -305
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