Reputation: 30655
In the below code why does the struct have two variable names?
#include <sys/resource.h>
int main (int argc, char **argv)
{
const rlim_t kStackSize = 64L * 1024L * 1024L;
struct rlimit rl; //HERE
int result = getrlimit(RLIMIT_STACK, &rl);
return 0;
}
Upvotes: 0
Views: 183
Reputation: 22342
If this is C, the struct
is just to tell C that it is in a different namespace.
See: understanding C namespaces
If this is C+++, then the struct
is not needed.
Upvotes: 1
Reputation: 122493
In C, struct with its tag together is a name, unless it's typedef
ed.
In C++, you can omit the struct
keyword.
Upvotes: 2