10

Pointers like this:
char* string;

Or like this:
char *string;

?

Comments
  • 3
    I've used both over time, but ended up on the char *string option in the end. Given the example of needing to do it this way for char *string1, *string2; I decided this was where it belonged.
  • 3
    First, the * defines the data type not the name so it belongs to the data type
  • 2
    Both are valid, but the second is preferred convention in most places.
  • 1
    @aul12 that is what I thought too, but it seems like the conventions don't agree..
  • 1
    Those are different data types you can't prefer one over the other
  • 0
    @bdhobare
    No it's the same thing. At least in c++
  • 1
    maybe like this
    char * str;
  • 1
    char* stuff == C++
    char *stuff == C
  • 1
    Pick one and stick with it.
Add Comment