im new and know how to make a struct in C++ but how do i make one in C?
im new and know how to make a struct in C++ but how do i make one in C?
You can use typedef's to create new variables types...Code:struct person { int age; char *name; }; ..... struct person me; me.age = 16; me.name = "serruya"; //use strcpy of course :P
hmm on the tutorial they said it was different in C
edit: oh... i see in C you put> struct structname identifier
Last edited by Mukunda51; 05-07-2003 at 07:27 AM.
struct struct_tag {
data_type1 variable1;
data_type2 variable2;
data_type3 variable3;
...
};
it seems the same as C++
It is done in the same manner as in C++. The creation policy in C++ is more so replication of C++. Th whole concept in C++ is to have classess, structs were there just to add backward compatibilty to the C++ system.
So if u know structs in C++, u know the most of structs in C, except finer tweaks like there are no classifies like privae, public.
No functions can be a part of struct
Code:struct anything{ int anyone; char anyday[100]; } done;