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...


Is there any difference between dlearations int* x and int
*x? If so tell me the difference?

Answers were Sorted based on User's Feedback



Is there any difference between dlearations int* x and int *x? If so tell me the difference?..

Answer / prasant

Reejusri is correct....
VC++ compiler complains with error
"error C2440: '=' : cannot convert from 'int' to 'int *'
1> Conversion from integral type to pointer type
requires reinterpret_cast, C-style cast or function-style
cas" for the following code

int *x,y,z;
x=y;

So, there is a difference.

Is This Answer Correct ?    0 Yes 2 No

Is there any difference between dlearations int* x and int *x? If so tell me the difference?..

Answer / reeju srivastava

There is no diffrence between int* x and int *x.
but difference will come into picture when you use:

Case 1:
int* x,y,z;

and

Case2:
int *x,y,z;

in first case x,y and z are integer pointer, where as
un second case only x is integer pointer rest y and z is
integer. So its always a good practice not to put multiple
variable in single line.

Is This Answer Correct ?    15 Yes 21 No

Is there any difference between dlearations int* x and int *x? If so tell me the difference?..

Answer / ramesh

ya...it is compiler dependent...it is good pracicce to give as
int *x;

Is This Answer Correct ?    7 Yes 15 No

Is there any difference between dlearations int* x and int *x? If so tell me the difference?..

Answer / kris

yeah no difference, only matters if we declare 2 or more
variables in the int* a,b,c kind of thing,

chai

Is This Answer Correct ?    0 Yes 10 No

Is there any difference between dlearations int* x and int *x? If so tell me the difference?..

Answer / reejusri

There is no diffrence between int* x and int *x.
but difference will come into picture when you use:

Case 1:
int* x,y,z;

and

Case2:
int *x,y,z;

in first case x,y and z are integer pointer, where as
un second case only x is integer pointer rest y and z is
integer. So its always a good practice not to put multiple
variable in single line.

Is This Answer Correct ?    4 Yes 23 No

Is there any difference between dlearations int* x and int *x? If so tell me the difference?..

Answer / sriram

yes. there is a difference.
Exactly to say, the second form is the integer pointer, but
the first form will produce an run time error.

Is This Answer Correct ?    0 Yes 36 No

Post New Answer

More C++ General Interview Questions

What is the size of pointer ? Also size of pointer in 64 bit pointer

4 Answers  


Write a C++ program which will compute the volume of a sphere or a cylinder after prompting the user to type the first character for the shape name.

0 Answers   An-Najah National University,


If you hear the cpu fan is running and the monitor power is still on, but you did not see anything show up in the monitor screen. What would you do to find out what is going wrong?

0 Answers  


Disadvantages of c++

8 Answers   HCL,


Is c++ a software?

0 Answers  


Enter n no. of element and delete value from desire position

1 Answers  


What is the protected keyword used for?

0 Answers  


What is function prototyping?

0 Answers  


What is the use of the this pointer?

3 Answers  


Define the process of error-handling in case of constructor failure?

0 Answers  


How do I open binary files?

1 Answers  


Which sort is best for the set: 1 2 3 5 4 a) Quick Sort b) Bubble Sort c) Merge Sort

0 Answers  


Categories