struct - C typedef for undeclared structure is not throwing any compilation error -


i wondering how typedef not throwing compilation error when used undeclared structure. below code compiling without warning , error. doubt how come typedef undeclared structure not throwing error. same in platforms

#include <stdio.h>  typedef struct undeclared_struct_st und_struct_s;  int main() {     printf("\nhello world\n");     return 0; } 

i executing program in suse 11 gcc 4.3.4.

typdef struct undeclared_struct_st und_struct_s; 

is valid. declares struct undeclared_struct_st incompele type , declares und_struct_s typedef struct undeclared_struct_st. cannot create objects of incomplete type can create pointers objects of incomplete type. struct undeclared_struct_st can declared in translation unit.


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -