#include<stdio.h>

main()

{

int a[3];

int *I;

a[0]=100;a[1]=200;a[2]=300;

I=a;

Printf(“%d\n”, ++*I);

Printf(“%d\n”, *++I);



Printf(“%d\n”, (*I)--);

Printf(“%d\n”, *I);

}

what is the o/p



a. 101,200,200,199

b. 200,201,201,100

c. 101,200,199,199

d. 200,300

Answer Posted / r.gopala krishnan (gk)


Explanation:
now 'I' variable pointing the base address of the
Array......
1.printf("%d\n",++*I); //I=a[0], bcos I is pointing the
base address. first Increamenting the value so,a[0]=100
become an ( a[0]=101 ).
2.printf("%d"\n,*++I); //This Increment will increment
the address not value. so, now ( I=a[1]=200 ).
3.printf("%d\n",*I--); // now I=a[1]=200 so value will
not change.
4.printf("%d\n",*I); //Now also I=a[1] pointing here only
but a[1]=199, bcos in previous printf after executing we
decrementing the value. a[1]=199......

ANS: a)101,200,200,199

Is This Answer Correct ?    12 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is file a keyword in c?

503


What is scope rule of function in c?

552


Explain how can I write functions that take a variable number of arguments?

613


How do I swap bytes?

629


Why enum is used in c?

524






What is the advantage of an array over individual variables?

744


What is pointer in c?

742


write a c program in such a way that if we enter the today date the output should be next day's date.

1680


Explain the priority queues?

626


Why is c called c?

629


Explain low-order bytes.

623


write a program for the normal snake games find in most of the mobiles.

1786


What is the difference between text files and binary files?

676


Why isnt there a numbered, multi-level break statement to break out

587


What is the advantage of using #define to declare a constant?

621