Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

study the code:
#include<stdio.h>
void main()
{
const int a=100;
int *p;
p=&a;
(*p)++;
printf("a=%dn(*p)=%dn",a,*p);
}
What is printed?
A)100,101 B)100,100 C)101,101 D)None of the
above

Answer Posted / abdur rab

the answer is c) 101, 101

a constant variable can be accessed using a pointer to
change the value because, during compilation the compiler
cannot see that the pointer is changing a contant read only
variable.

the same method can be applied over the private members in
a c++ class also.

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a pointer in c plus plus?

1382


In which language linux is written?

1284


What is the meaning of && in c?

1085


What is use of pointer?

1164


When should volatile modifier be used?

1070


When can you use a pointer with a function?

1148


What are the header files used in c language?

1093


Can you write the algorithm for Queue?

2172


What is the difference between constant pointer and constant variable?

1274


What would the following code segment printint k = 8;docout << "k = " << k << " ";while k++ < 5; a) 13 b) 5 c) 8 d) pointers

1303


Can a variable be both const and volatile?

1186


Explain what are the __date__ and __time__ preprocessor commands?

1156


Explain 'far' and 'near' pointers in c.

1186


On most computers additional memory that is accessed through an adapter of feature card along with a device driver program. a) user memory b) conventional memory c) expandedmemory d) area

1162


Write a program for finding factorial of a number.

1140