I use the following code to find the disk usage of my /
int main()
{
struct statfs *stat;
statfs64("/tmp",stat);
perror("");
printf("%lu \n",stat->f_bfree*stat->f_bsize);
return 0;
}
The perror keeps on printing "Bad Address" and a random number for size.
Bad address
3264987920
PS:I tried sudo ./a.out
,statfs("a.out",stat)
What may be the issue?