Structure in C language Reviewed by Momizat on . Structure is the combination of logically related data items with in a single unit or block.The data items are enclosed with in the structure block are known as Structure is the combination of logically related data items with in a single unit or block.The data items are enclosed with in the structure block are known as Rating: 0

Structure in C language

Structure is the combination of logically related data items with in a single unit or block.The data items are enclosed with in the structure block are known as the member of structure.
The functions of the structures are known as the member function of structure.The data member of function of the structure may be of same or different datatypes like int,float,char etc.

structure is mainly use to create user define datatype and variable which can be member the same variable of the same datatype the primary object of the structure is the better organization and management of the data in a program. A structure is always declare with the keyword ‘struct’ opens with the opening chain bracket and terminates with the closing chain bracket and the semicolon.The structure does not allow any data member to assign any value.

struct
{
	data member:::
	::::::::::::::

}

Assign structure member

C language provide period operator(.) to access the member of the structure independent. the period operator connects a structure variable and its member.


struct test{

int a,b,c;

}
main(){
	clrscr();
	test t;
	printf("Enter two no.:-");
	scanf("%d%d",&t.a,&t.b);
	t.c=t.a+t.b;
	printf("Sum is :- ",&t.c);
	getch();
}

Leave a Comment

© 2014 Powered By