All programming languages I am familiar to (C/C++, Java, C#, Objective C) accept both notations. So I want to know which is semantically correct: Object* myObj or Object *myObj?
All programming languages I am familiar to (C/C++, Java, C#, Objective C) accept both
Share
Well, it depends. Both are correct but I generally use the Object*, because the pointer itself can be considered a type and it is more readable.
But there is a problem with that. The pointer in C, by real, is just a modification of a type, and not a real type. If you declare multiple variables in one single line as this:
You will have
aas a pointer to Object andbas one instance ofObject, so I imagine that the correct way is to put the pointer with the variable.