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
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 |
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 |
Answer / ramesh
ya...it is compiler dependent...it is good pracicce to give as
int *x;
| Is This Answer Correct ? | 7 Yes | 15 No |
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 |
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 |
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 |
Can I uninstall microsoft c++ redistributable?
Write a program that takes a 5 digit number and calculates 2 power that number and prints it.
what is difference between internet and Internet?
12 Answers College School Exams Tests, Microsoft, MIT, TCS,
What are the storage qualifiers?
What is c++ vb?
What is the main use of c++?
What is the difference between a declaration and a definition?
What is object file? How can you access object file?
When does a 'this' pointer get created?
How can you link a c program with a c function?
Write about the stack unwinding?
Is c++ a high level language?