What’s the difference between
struct point var, *varptr;
and
struct point *var;
Can we just use the second one without assigning any variable’s address to it?
>Solution :
The difference is that this statement creates two variables:
struct point var, *varptr;
It has the same effect as using 2 statements:
struct point var; // type struct point
struct point *varptr; // type pointer to struct point
And this statement creates 1 variable:
struct point *var; // type pointer to struct point
Can we just use the second one without assigning any variable’s address to it?
Yes you can use the second one but you would want to initialize it to something (usually another variable’s address) before derefrencing the pointer.