What is the use of Structure in C? tccicomputercoaching.com
Structures have very efficient role in c. As you can see the Array- it is used for same type of data. It contains you can have different type of data to define a real-time entity like books, student, etc.
Structure is a data type which allows to store different type data at same location at same time.
The most efficiently data structures are used in c is stack, queue, tree, linked list, doubly linked list, hash table etc.
Use of Structure:
· Suppose you are having record of 100 students. Each student is having name(which is of char type), id(int type) and marks(float type). All these three properties is uniquely owned by each student. Each student will carry this three different data type information.
· Now, suppose you have to pass complete information of all students to one function for some reason. At that point rather than passing each and every information (name, id, marks, etc…) one by one for every student will not be a good way of programming. In such case we will prefer approach in which can pass complete student information as an single entity of one by one student.
· Hash table, it is used for making table for particular entity. For example an attendance register of a classroom. ( Inside system, kernel maintains process table, file table, inode table, etc etc.)
· So, where ever we need to refer different data types information as an single entity then we go for structure and above is the real time example where we would like to go for structure.
TCCI can teach you all programming Language at your flexible time.
To learn Structure in C at TCCI .
Call us @ 98256 18292
Visit us @ http://tccicomputercoaching.com/course/