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?
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.
@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!