Math, asked by shahininelapudi, 1 month ago

Output of the following program:#include<stdio.h>main(){ int a[] = {10, 20, 30, 40, 50); char*
ptr = a; int* iPtr = (int")(a+4); printf("%d", -*iPtr+1);}
21
40
O 41
O 51​

Answers

Answered by meenajignesh
0

Answer:

vvVvavavfjxd, and I am a quick look at the top of

Answered by ankhidassarma9
0

Answer:  Output of the following program is 51

Step-by-step explanation:

#include <stdio.h>

void main()

{    int a[] = {10, 20, 30, 40, 50};

   char*ptr = a;

   int* iPtr = (int*) (a+4);

   printf("%d", *iPtr+1);

}

  • int a[] = {10, 20, 30, 40, 50}; this statement declared an integer array a[] containing 5 integer values. 'a' is containing the base address of this array.
  • char*ptr = a; this statement is storing the  base address (value of 'a') into a character pointer ptr.
  • int* iPtr = (int*) (a+4); This statement declared as integer pointer iPtr and stores the address if the 5th element of the array , i.e. the address of 50;
  • printf("%d", *iPtr+1); this statement will print the the value at address iPtr plus 1 i.e. 50 + 1 =51.
Similar questions