38 38 votes Consider the following C program: #include <stdio.h> int main() { int arr[]={1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 5}, *ip=arr+4; printf(“%d\n”, ip[1]); return 0; } The number that will be displayed on execution of the program is _______ Programming in C gatecse-2019 numerical-answers programming-in-c programming array easy one-mark + – Arjun 23.8k views answer comment Share Follow Print See all 4 Comments 4 4 Comments reply Ashwani Kumar 2 commented Jun 3, 2019 reply Follow flag arr is base address of element $1$. arr+$4$ is base address of element $5$. Let it ip. ip[$1$]=*(ip+$1$)= Base address of element $6$. 6 is the answer. 14 14 replyShare subbus commented Apr 27, 2020 reply Follow flag *p = arr + 4 = arr[4] *(p+0) = arr[4] *(p+1) = arr[4+1] = arr[5] 2 2 replyShare mahendrapatel commented Jan 23, 2023 reply Follow flag Easy 1 1 replyShare himanshud2611 commented Jan 28, 2024 reply Follow flag ip[1] is *(ip+1) i.e 6 0 0 replyShare Please log in or register to add a comment.
1 1 vote given : *ip = (a + 4) = &(a[4]) ip = (a+4) ip[1] = *(ip+1) = *( (a+4) +1 ) ip[1] = *(a+5) = a[5] = 6 correct me if i am wrong Sarang_Gajare answered Jul 10, 2024 Sarang_Gajare comment Share Follow 0 reply Please log in or register to add a comment.
0 0 votes This is how I've solved*ip=arr+4 (It is saying move 4 elements ahead and stop)Techically: ip=arr(base address) + 4*size(each element)From the perspective of ip: {5, 6, 7, 8, 9, 0, 1, 2, 5} ip is pointing 5ip[1] Asked ip[1]=ip(address)+1*size(element) 6 is the answer NowOrNever answered Jul 4 NowOrNever comment Share Follow 0 reply Please log in or register to add a comment.
0 0 votes This is how I've solved*ip=arr+4 (It is saying move 4 elements ahead and stop)Techically: ip=arr(base address) + 4*size(each element)From the perspective of ip: {5, 6, 7, 8, 9, 0, 1, 2, 5} ip is pointing 5ip[1] Asked ip[1]=ip(address)+1*size(element) answer 6 NowOrNever answered Jul 4 NowOrNever comment Share Follow 0 reply Please log in or register to add a comment.
0 0 votes Correct answer: 6 port67 answered Jul 28 port67 comment Share Follow 0 reply Please log in or register to add a comment.