C Struct : typedef Doubt !
- by Mahesh
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;
}