retagged by
13,600 views
14 votes
14 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 _______

retagged by

6 Answers

2 votes
2 votes
The program asks for what is the out put of printing ip[1] ,for that we need to understand what ip[1] represents here .it represents the second element of ip[ ] .What ip[ ] represents ? it represents arr[4] so what ip[1] will represent it will be arr[4+1] which is 6 .
1 votes
1 votes
After executing the line---- *ip=arr+4

ip will point to the element 5.

so ip[0]=5

ip[1]=6

ip[2]=7 ......

Answer-->6
Answer:

Related questions

21 votes
21 votes
3 answers
5
18 votes
18 votes
2 answers
6
Arjun asked Feb 7, 2019
15,512 views
Consider the following C program:#include <stdio.h int main() { int a[] = {2, 4, 6, 8, 10}; int i, sum=0, *b=a+4; for (i=0; i<5; i++) sum=sum+(*b-i)-*(b-i); printf("%d\n"...
13 votes
13 votes
4 answers
7
Arjun asked Feb 7, 2019
9,682 views
Consider the following C program :#include<stdio.h int jumble(int x, int y){ x = 2*x+y; return x; } int main(){ int x=2, y=5; y=jumble(y,x); x=jumble(y,x); printf("%d \n"...
59 votes
59 votes
9 answers
8
Arjun asked Feb 7, 2019
27,356 views
Consider the following C program:#include <stdio.h int r() { static int num=7; return num ; } int main() { for (r();r();r()) printf(“%d”,r()); return 0; }Which one of...