i remember an online argument on a forum like 15 years ago where one set of people would say "each to their own" and the other would say "to each their own" and remarkably both sides were able to explain to the other why the syntax made sense to them. there were posts like "oh, you mean each person to their own preference!" i often think of it when there's some nomenclature thing which basically doesn't matter but both sides seem unable to see where the other is coming from

anyway, with this in mind, can someone explain something to me? in C, i tend to write this:

int* x;

i write it like that because i believe i am bringing into existence x, whose type is "a pointer to an integer". it's not an int, it's an int pointer. so i write int*, because that's what type it is. it seems clearer that way. however i often see this:

int *x;

this seems less clear, but some (most?) people obviously think THAT way is the clearer way. if you do, what's your thought process?

i suppose if you write int *x = 9; then it makes sense as you need to dereference it to set it, right? so you're probably thinking of the * as an operator and not as a type specifier/modifier. e.g. i'm thinking of it as an adjective, and you're thinking of it as a verb? something like that?

my hottest take here is probably this:

int_ptr a;
printf("%x\n", a); // 0x0
printf("%d\n", sizeof(int_ptr)); // 8

a = stalloc(sizeof(int_ptr));
printf("%x\n", a); // 0x02BF26A...

poke(a, 10);
printf("%d\n", peek(a) ); // 10

@jk Consider this:

int* a, b;

This declares one pointer and one integer, which doesn't agree with the way you were thinking of it in your first example.

@kaelef i never really notice this i guess since i never do multiple declarations on the same line, they've always looked ugly to me

@jk Like you said, it's a matter of preference in a simple declaration like you showed, but it might lead one to thinking of '*' in a way different from how the language technically views it, so I'd discourage a beginner from using that form. It's strictly an operator that binds to the declarator, not the type specifier.

One of the great things about C is that it gives you a ton a freedom as long as you know what you're doing!