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


Please Help Members By Posting Answers For Below Questions

Is arr and &arr are same expression for an array?

834


Evaluate as true or false: !(1 &&0 || !1) a) True b) False c) Invalid statement

873


Can a function take variable length arguments, if yes, how?

809


What is a linked list in c++?

818


Explain the use of virtual destructor?

850


Why is standard template library used?

824


What is function overloading c++?

815


What kind of problems can be solved by a namespace?

838


In c++, what is the difference between method overloading and method overriding?

852


How many types of scopes are there in c++?

821


What are the sizes and ranges of the basic c++ data types?

830


Does c++ support exception handling?

832


What is name hiding in c++?

922


What is a modifier in c++?

888


What is an undefined behavior and sequence points

778