+ 3
How to create own data-types in cpp?
8 Respostas
+ 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
+ 7
You can also create custom named datatypes with typedef using predefined datatypes, like so:
typedef int test;
test name = 5;
+ 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.
+ 3
here is a small code example:
https://code.sololearn.com/csgOv49C872g/#cpp
+ 1
And how to create data type which can storege as many digits as I want (example 100)
+ 1
You can also create custom named datatypes with typedef using predefined datatypes, like so:
typedef int test;
test name = 5;
+ 1
You can use structure in cpp to create your own datatype.
for example:-
struct rectangle
{
int length;
int breadth;
};
- 2
small code