CaptionsMaker
.com
Lecture 21: Learn Structure of C and C++ in Punjabi Language, struct keyword.
Edit Subtitles
Download Subtitles
SRT
TXT
Title:
Description:
Structures 1. A structure can be defined as a collection of variables of the same or different types. 2. This group of variables is given a common name known as the name of the structure. 3. The individual variables in a structure are known as member of the structure. Declaring the data in the form of a structure has several advantages. The main advantage is that we can group together several related data items of same type. The group of variables has a common name and common memory location. A structure declaration starts with the keyword struct. A structure is a user defined data type, which represents different types of data within a single group. When you need to store a large data items in one group you made the use of array. The disadvantage of arrays is that it is used to store data items, which are of similar data types. You may have to store different types of data say an int, a char, a float value or may be even an array all together in a group. This situation of string different data types in a single group can be done only by structure. Structures are the most common tools used to make these situations possible. Array store all its elements in continuous location but structure is not. Differentiate between a structure and an array. Structure and array both are user defined data types. But structure is collection of dissimilar data type whereas array is collection of similar data type Structure: It is user defined data type. In a structure we can store various data type variables to make a record. The size of structure is the sum of the memory required by all the variables defined in it. Union: It is user defined data type. In a structure we can store various data type variables to make a record. The size of the union is the maximum size variable defined in it. Struct exp { int rollno; char name[25]; }; Union exp { int rollno; char name[25]; }; 1. The values of a structure variable can be assigned to another structure variable of the same type using the assignment operator. 2. One structure can be nested within another structure. Using this facility complex data types can be created. 3. Like an ordinary variable, a structure variable can also be passed to a function. We may either pass individual structure elements or the entire structure at one go. 4. The way we have a pointer pointing to an int, or a pointer pointing to a char , similarly we can have a pointer pointing to a structure. Such pointers are known as ‘structure pointers’. Music information: I Am a Man Who Will Fight for Your Honor by Chris Zabriskie is licensed under a Creative Commons Attribution license (https://creativecommons.org/licenses/...) Source: http://chriszabriskie.com/honor/ Artist: http://chriszabriskie.com/ ਮੈਂ ਕਿਤੇ ਗਲਤ ਹੋ ਸਕਦਾ ਹਾਂ, ਕਿਰਪਾ ਕਰਕੇ ਟਿੱਪਣੀ ਵਿੱਚ ਮੈਨੂੰ ਸਹੀ ਕਰੋ. ਅਗਲੇ ਵਿਡਿਓ ਵਿੱਚ ਮੈਂ ਇਸ ਗ਼ਲਤੀ ਨੂੰ ਠੀਕ ਕਰ ਦਿਆਂਗਾ.
YouTube url:
https://youtu.be/TUcOjYQ6zXA
Created:
6. 1. 2022 12:55:00