#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

What is the difference between a string and an array?

703


write a program to generate address labels using structures?

4005


What is the difference between volatile and const volatile?

559


what is the difference between 123 and 0123 in c?

716


When should you not use a type cast?

656






What is static function in c?

629


What happens if you free a pointer twice?

606


i = 25;switch (i) {case 25: printf("The value is 25 ");case 30: printf("The value is 30 "); When the above statements are executed the output will be : a) The value is 25 b) The value is 30 c) The value is 25 The value is 30 d) none

640


What are the rules for identifiers in c?

581


What is volatile c?

520


What is difference between constant pointer and constant variable?

626


Why main is used in c?

583


main(){char *str;scanf("%s",str);printf("%s",str); }The error in the above program is: a) Variable 'str' is not initialised b) Format control for a string is not %s c) Parameter to scanf is passed by value. It should be an address d) none

723


What is #define?

571


What is the right type to use for boolean values in c?

580