In my sample code below:
#include <stdlib.h>
#include<stdio.h>
int main()
{
typedef struct {float x; float y;}C;
C z;
z.x=4;
z.y=6;
C *zpt=&z;
*zpt.x;
printf("%f",(*zpt).x);
}
I know (*zpt).x
or zpt->x
is used to dereference the pointer. But I get an error when I use *zpt.x
, Error - "request for member 'x' in something not a structure or union". Can someone explain what does *zpt.x
do? Is this an valid syntax and if yes, where and how it should be used?