C Struct : typedef Doubt !

Posted by Mahesh on Stack Overflow See other posts from Stack Overflow or by Mahesh
Published on 2011-01-15T15:35:49Z Indexed on 2011/01/15 15:54 UTC
Read the original article Hit count: 176

Filed under:
|
|

In the given code snippet, I expected the error symbol Record not found. But it compiled and ran fine on Visual Studio 2010 Compiler. I ran it as a C program from Visual Studio 2010 Command Prompt in the manner -

cl Record.c
Record

Now the doubt is, doesn't typedef check for symbols ? Does it work more like a forward declaration ?

#include "stdio.h"
#include "conio.h"

typedef struct Record R;
struct Record
{
    int a;
};

int main()
{   
    R obj = {10};
    getch();
    return 0;
}

© Stack Overflow or respective owner

Related posts about c

    Related posts about struct