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 c++ vector a linked list?
What is the main purpose of overloading operators?
What is a multimap c++?
How would you differentiate between a pre and post increment operators while overloading?
What is c++ 11 and c++ 14?
What doescout<<(0==0) print out a) 0 b) 1 c) Compiler error: Lvalue required
Write a program which is required to process the time of a clock in hours and minutes, entered from the keyboard. With this program, there are two requirements for any data entered by a user: 1. The data must be of the correct type (in this case, two ints). 2. The data must be in the correct range: this means that, for the minutes, negative numbers and any number above 59 must be rejected; for the hours, negative numbers and any number above 23 must be rejected. Output error message for invalid data input. Output the time one and a half hour after the time input. i.e. Hour: 22 Min: 32 One and a half hour after 22:32 is 00:02
How are Structure passing and returning implemented by the compiler?
Is c# written in c++?
What are the basics of local (auto) objects?
How const int *ourpointer differs from int const *ourpointer?
What is operator overloading in c++ example?
What is the difference between mutex and binary semaphore?
What does it mean to declare a member function as virtual?
What is low level language in simple words?