+ 3

How to create own data-types in cpp?

15th Jan 2019, 6:44 PM
Cлaвeн Ђервида
Cлaвeн Ђервида - avatar
8 ответов
+ 9
You can use structures to make your own data type. Visit the link below for detailed explanation: https://www.programiz.com/cpp-programming/structure
15th Jan 2019, 7:03 PM
blACk sh4d0w
blACk sh4d0w - avatar
+ 7
You can also create custom named datatypes with typedef using predefined datatypes, like so: typedef int test; test name = 5;
15th Jan 2019, 8:48 PM
Dread
Dread - avatar
+ 5
In order to create user defined data type we can use structure(mainly in c) or classes(in c++ /java). For eg:-if we have to store information of students like roll no. ,marks,name etc...then in that very case we can use class or structure and using their instances we can access thier data.
30th Jul 2020, 3:37 PM
~प्रिया
~प्रिया - avatar
+ 3
here is a small code example: https://code.sololearn.com/csgOv49C872g/#cpp
15th Jan 2019, 8:46 PM
MO ELomari
MO ELomari - avatar
+ 1
And how to create data type which can storege as many digits as I want (example 100)
15th Jan 2019, 7:07 PM
Cлaвeн Ђервида
Cлaвeн Ђервида - avatar
+ 1
You can also create custom named datatypes with typedef using predefined datatypes, like so: typedef int test; test name = 5;
1st May 2020, 2:44 PM
FarrasHyy
+ 1
You can use structure in cpp to create your own datatype. for example:- struct rectangle { int length; int breadth; };
25th Dec 2020, 5:50 AM
Prabin Prab
Prabin Prab - avatar
- 2
small code
20th Sep 2019, 2:37 PM
Moesha Mccollin
Moesha Mccollin - avatar