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

which of the following is not an secondary constant a) array b) real c) union

1272


Describe the advantages of operator overloading?

577


How do I run a program in notepad ++?

606


What is polymorphism in c++? Explain with an example?

607


Define a conversion constructor?

623






Differentiate between structure and class in c++.

604


What is the use of typedef?

638


Tell me difference between constant pointer and pointer to a constant.

633


What flag means?

527


What is a c++ vector?

595


When can I use a forward declaration?

626


What are multiple inheritances (virtual inheritance)?

585


What is abstraction in c++ with example?

564


How much do c++ programmers make?

566


What do you know about near, far and huge pointer?

603