I'm learning C
through learn-c.org and sometimes they use the *
operator before writing something (like specifying a data type) and other times they put the asterisk at the end. I read that *
was the operator that de-references a variable. What is the difference in the placement of *
?
some examples from the website:
void addone(int * n) {
(*n)++;
}
and
char vowels[] = {'A', 'E', 'I', 'O', 'U'};
char *pvowels = &vowels;
int i;
or
int compare(const void* left, const void* right) {
return (*(int*)right - *(int*)left);
}