
Introduction to Data Structures and User-Defined Types
Explore the fundamentals of data structures including user-defined types like typedef and enums, derived data types like arrays and structures, as well as unions. Learn how to define, create, and manipulate various data types in programming.
Download Presentation

Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.
E N D
Presentation Transcript
Chapter 1: Introduction to Data Structures(8M) Visit for more Learning Resources
User Defined Data types- typedef, enum type definition allows user to define variable of existing data type. Example. typedef float marks ; marks m1,m2,m3; (in above example marks is used as float data type)
Enumerated data type: enum day(Mon , Tue ,wed ,Thu ,Fri ,Sat , Sun) enum day today; today=Thu
Derived data types- Array ,Structures Array: It is collection of homogeneous data type elements stored in contiguous memory locations. E.g. int a[5]; Element of array is accessed with a[i] where a is the array and i is the index . a[0] a[1] a[2] a[3] a[4]
Structures: It is collection of non-homogeneous (heterogeneous) elements. Using structure we can easily handle complex data structures Elements of structure can be accessed using dot(.) operator E.g. struct stud { int char name[35]; int roll_no; char addr[50] }s; s.Name //access the name field
Union It is similar to structure data type . Difference between structure and union is that in structure every data member has its own storage where members of union shares same memory locations. Elements of structure can be accessed using dot(.) operator Storage for below union is 4bytes E.g union item { int m; //2byte float z; //4 byte char c; //1 byte }u; For more detail contact us