Reputation: 1438
With GNU indent is there a way to put the "star" right after the type?
For example:
void* foo(int* a)
but keeping it near the var in a declaration like
int *a, b;
Upvotes: 1
Views: 873
Reputation: 11921
C standard doesn't say anything about keeping *
immediately after type
or before variable name
, both are fine.
int *ptr1, ptr2;/* valid, ptr1 is pointer variable, ptr2 is normal variable */
int* ptr1, ptr2;/* valid, ptr1 is pointer variable, ptr2 is normal variable */
Similarly in function declaration or definition for e.g
void* foo(int* a) {
/*...*/
}
or
void* foo(int *a) { /* a is int pointer */
/*...*/
}
Read this Placement of the asterisk in pointer declarations
Upvotes: 3