What is the difference between int* ptr and int *ptr in C?
Spaces in C are mostly insignificant. There are occasional cases where spaces are important, but these are few and far between. The two examples you posted are equivalent.
To the compiler, there is no difference between the two declarations.
To the human reader, the former may imply that the "int*" type applies to all declarations in the same statement. However, the * binds only to the following identifier.
For example, both of the following statements declare only one pointer.
int* ptr, foo, bar;
int *ptr, foo, bar;
This statement declares multiple pointers, which prevents using the "int*" spacing.
int *ptr1, *ptr2, *ptr3;