Structure in C - Structure of C Program
Learn c - c tutorial - Structure of C Program - c examples - c programs
Structure of C Program
- Data type declaration that defines a physically classified list of variables to be placed under one name in a block of memory or the struct declared name which returns constant address.
- Complex and simple data types in an association can contain many other Struct and the natural organizing type for records like a mixed data types in lists of directory entries reading a hard drive length, name, extension, physical (cylinder, disk, head indexes, address, etc.),
Learn c - c tutorial - Structure of C Program - c examples - c programs
Sample Code
#include <stdio.h>
struct tagname {
char Char;
int Int;
float Dec;
};
int main()
{
struct tagname StructObj;
struct tagname *ptrStructObj=&StructObj;
StructObj.Char='H';
ptrStructObj->Int=927;
ptrStructObj->Dec=911.0f;
printf("%C\n",StructObj.Char);
printf("%d\n",ptrStructObj->Int);
printf("%f",ptrStructObj->Dec);
return 0;
}
Output
H
927
911.000000