AnuragSrivastava272
184 views
7 slides
Jun 22, 2020
Slide 1 of 7
1
2
3
4
5
6
7
About This Presentation
This PPT is about the computer language, if you want to see in detail visit the Be a Programmer channel on YouTube.
Size: 85.19 KB
Language: en
Added: Jun 22, 2020
Slides: 7 pages
Slide Content
What is non primitive data type? structure a rray union pointer
Non-primitive or derived data types simply means it is derived from the available source, we have some primitive data types in C like int, char, float. When we make some more variables using these primary variable that does some different task or specific task is called as derived data type or non–primitive data type.
Types of Non- primitive data type : Array 2. Structure 3. Union 4. Pointer
Array It is a continuous memory storage of same data type, homogeneous storage. a [0] 1 a[1] 2 a[2] 3 a[3] 4 a[4] 5 a[5] 6 a[6] 7 a[7] 8 a[8] Syntax : data_type variable[size]; Example : int a[9];
Structure It is a special data type in which we can store different types of variables under same name. Uses keyword struct to declare. Syntax : struct name { Member variable1; Member variable2; } struct_variable ; Example: struct employee { i nt id; c har name[10]; float salary; } emp1;
Union It uses keyword union, it can store different type of variables under same storage. The size of union will be the maximum size of the variable in it. Syntax : union name { Member variable1; Member variable2; } union_variable ; Example: union test { i nt x; c har name[10]; float salary; } data1;
Pointer It is a variable used to store address of another variable, it uses an indirection operator( * ). It is a powerful concept of C, it is used further in link lists. Example: i nt a=10; i nt * ptr =&a; a =10 Hf23 Hf23 ptr FF43 ptr address of a = Hf23 * ptr value of a = 10