jweinst1
6/27/2017 - 10:52 PM

example of casting priority in C

example of casting priority in C

#include "stdio.h"
#include "stdlib.h"

struct doo {
  void* data;
};

//casting operator priority

int main(void) {
  struct doo g = {(int*)malloc(4)};
  struct doo* s = &g;
  const int ssss = 4;
  *((int*)s->data) = ssss;
  printf("%d\n", *((int*)s->data));
  int* hhh = ((int*)s->data);
  printf("%d\n", *hhh);
  return 0;
}