Why does this work :
char *fd = "myfile.txt";
struct stat buf;
stat(fd, &buf);
int size = buf.st_size;
printf("%d",size);
But this does not work:
char *fd = "myfile.txt";
struct stat *buf;
stat(fd, buf);
int size = buf->st_size;
printf("%d",size);