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

Hi I need exam pattern for ECIL Computer/IT category...

1 Answers  


What is the latest Exchange 2003 Service Pack? Name a few changes in functionality in that SP.

0 Answers   Wipro,


Streams can be for writing the data to a.txt file

1 Answers  


How to write a test case for an extra Commerce website can any one tell this with the help of a table

0 Answers   TresBizz,


Give an algorithm for the following problem and determine its time complexity. Given a list of n distinct positive integers, partition the list into two sublists, each of size n/2, such that the difference between the sums of the integers in the two sublists is maximized. You may assume that n is a multiple of 2 (i.e. n is even).

1 Answers  






Automation of XYZ Soft drink parlour XYZ Soft drink Parlour wants to automate its functionalities. The Admin can add new items in the stock and also update the details of the existing items. The items are only soft drinks .The details to be maintained are Item’s name, quantity and price. The salesman can view the availability of the items as per the order placed then confirms the order. At the end of day the Admin generates a report of the total sales (total quantity and price of individual items). Identify the Joins , union, and Cartesian product Report.

1 Answers  


hai im going to face ibps SO IT officers grade 1 interview. if anyone had an idea plz tel me expected and experienced questions and mail to anusha_k_anu@yahoo.com

0 Answers  


HI!I AM A STUDENT OF B.TECH 3RD YEAR.I PASSED SECONDARY EXAM IN 2001 & HIGHER SECONDARY EXAM 2003.BUT I DROP 1 YEAR AND ADMITTED IN B.TECH 2004 DUE TO FINANCIAL CRISIS.WHEN INTERVIEWER LOOK AT MY C.V HE WANT 2 KNOW WHAT U DID IN THAT MISSED YEAR? I GET PUZZLED 2 ANSWER THIS QUESTION AS I CAN NOT FIND ANY BOLDER ANSWER.PLZ SUGGEST ME SOME BOLD ANS. THAT INTERVIEWER CAN NOT FIND ANY COUNTER QUARY.... 0 2

4 Answers   TCS, Tech Mahindra,


what are the examples of E-Based Applications?

1 Answers  


hi this is padhu i just want to know about remote sensing scientist in ISRO, will there a written test or not if there are any model test papers plz post it.

1 Answers  


why IT?

0 Answers  


what are the things to be mentioned for the question "Tell me about yourself??

6 Answers   CTS, Patni,


Categories
  • Civil Engineering Interview Questions Civil Engineering (5085)
  • Mechanical Engineering Interview Questions Mechanical Engineering (4452)
  • Electrical Engineering Interview Questions Electrical Engineering (16638)
  • 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)