typedef struct _FOO {
int blah;
int blah2;
int blah3
} FOO, *FOO;

1.) Does this create 2 objects of type FOO and another that is a pointer to a FOO?
2.) OR does it just typedef the names so you don't have to do the following

    struct __FOO fooStruct;
    struct __FOO *fooPtr;
           now i can do
    FOO fooStruct;
    FOO *fooPtr;

Recommended Answers

All 2 Replies

It is (2)

Run this program. This should clear your confusion

#include<stdlib.h>

typedef struct Person
{
        char fname[100];
}FOO,*FOO1;



int main()
{
        FOO f1;
        FOO1 f2;
        printf("%d %d\n",sizeof(f1),sizeof(f2));

        return 0;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.