3 votes 3 votes Programming in C made-easy-test-series programming pointers array + – Sakshi Jaiswal asked Oct 1, 2018 • edited Mar 4, 2019 by Aditi Singh Sakshi Jaiswal 954 views answer comment Share Follow See all 10 Comments See all 10 10 Comments reply Show 7 previous comments abhi19961 commented Dec 16, 2018 reply Follow Share I am not able to understand the second statement in main().Can you explain how the typecasting is working?And yes the answer is A. 0 votes 0 votes air1ankit commented Dec 16, 2018 i edited by air1ankit Dec 17, 2018 reply Follow Share its mean arr [6] = 10 20 30 40 50 60 x y 1000 1001 1002 1003 1004 1005 1006 1007 . char *ptr = (char*) (& arr +1) = skip the array arr[6] and reach to 1006 now in the next line, they were given, (ptr−1) its mean that 1006-1 =1005 *(ptr-1) = 60 @srestha ma'am please check 0 votes 0 votes akash.dinkar12 commented Mar 3, 2019 reply Follow Share https://gateoverflow.in/254355/test-series-question https://gateoverflow.in/254844/3d-array https://gateoverflow.in/254912/multidimensional-array https://gateoverflow.in/221529/multidimensional-pointer-arithmetic check all if you want clear explanation 0 votes 0 votes Please log in or register to add a comment.
1 votes 1 votes arr [6] = 10 20 30 40 50 60 x y 1000 1001 1002 1003 1004 1005 1006 1007 . char *ptr = (char*) (& arr +1) = skip the array arr[6] and reach to 1006 now in the next line, they were given, (ptr−1) its mean that 1006-1 =1005 *(ptr-1) = 60 Nigam Modi answered Aug 16, 2019 Nigam Modi comment Share Follow See all 0 reply Please log in or register to add a comment.
0 votes 0 votes 1st element 20 and last element 60 will be printed Anup dogrial answered Jan 7, 2020 Anup dogrial comment Share Follow See all 0 reply Please log in or register to add a comment.