The use of *
is all so confusing especially for us new comers to C. I mean, how do you easily differentiate the use of *
as a pointer, *
as a de-reference operator, *
as a multiplication operator? I see alot of different use of *
online and it's quite confusing, especially regarding different positions of the *
e.g. as in the sample code below. What positions of *
are correct and advisable to use to avoid confusion with pointers, de-referencing and multiplication?
Code is just sample and may...infact will not compile.
int main(void){
int *size, length, width;
*size1= malloc(sizeof(int) * length);
*size2= (int *) malloc(width * sizeof(int) * width);
*size3= malloc(sizeof(int) *length);
printf("%d\n%d\n%d\n", size1,size2,size3);
return (0);
}
N.B: I'm new in C and pls don't refer me to useless links and ("supposedly") duplicates that doesn't answer exactly same question as this...pls allow others to air their views so we get maximum answers, none knows it all, u will be surprised that something new can pop-up, even for the so called C old-timers.