I was looking at piece of code here that I was gonna use:
#include <sys/stat.h>
struct stat sb;
if (stat(pathname, &sb) == 0 && S_ISDIR(sb.st_mode))
{
...it is a directory...
}
I suppose that if I'm going to use it, I should probably understand what it does. My question is about the line
struct stat sb;
What does that mean? I've known struct
in the sense of declaring it like
struct node { int val; node * next; }
and so I'm confused about why there are 2 tokens after the struct declaration.