#include<stdio.h>
#define KOREA "대한민국"
char* My_strcpy(char* dest, const char* src);
What is the difference between "char* p" and "char *p"?
#include<stdio.h>
#define KOREA "대한민국"
char* My_strcpy(char* dest, const char* src);
What is the difference between "char* p" and "char *p"?
There is no difference, it is only a matter of style.
Like John Skeet wrote in a former comment (for another topic):
Different people have different conventions for that.
char* p
and char *p
are exactly equivalent.
In many ways, you ought to write char *p
since, really, p
is a pointer to char
. But as the years have ticked by, most folk regard char*
as the type for p
, so char* p
is possibly more common.
But do note though that char* p, q;
actually declares p
as a pointer to a char
and q
as a char
! If you wanted two pointers, you would have to write char *p, *q;
or the incredibly obfuscated
char* p, *q;
.
char* p
and char *p
are the same. As is char*p
and char * p
.