Is there any difference between dlearations int* x and int
*x? If so tell me the difference?
Answer Posted / foo
The difference is that in the first case the space is after
the * and in the second case the space is before.
Functionally there is no difference.
Arguably int* x is slightly worse since (as other answers
demonstrate) people can misinterpret "int* i, j" as
declaring two pointers-to-int where "int *i, j" is perhaps a
bit clearer.
Practically, you should adopt whatever style is required by
wherever you work or whomever you work with.
Is This Answer Correct ? | 4 Yes | 1 No |
Post New Answer View All Answers
Is arr and &arr are same expression for an array?
Evaluate as true or false: !(1 &&0 || !1) a) True b) False c) Invalid statement
Can a function take variable length arguments, if yes, how?
What is a linked list in c++?
Explain the use of virtual destructor?
Why is standard template library used?
What is function overloading c++?
What kind of problems can be solved by a namespace?
In c++, what is the difference between method overloading and method overriding?
How many types of scopes are there in c++?
What are the sizes and ranges of the basic c++ data types?
Does c++ support exception handling?
What is name hiding in c++?
What is a modifier in c++?
What is an undefined behavior and sequence points