How can I make my custom data types? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How can I make my custom data types?

How can I make my own data type? I know in Pascal language, I can use type dat = longint; To make a new data type called "dat" that is equivalent to long int. How can I do that in c++ ? For example I want to make a data type called "dat" that is equivalent to "long long int". How can I do it? Thanks in advance!

7th May 2019, 2:31 PM
Noverdi Ramadhan
Noverdi Ramadhan - avatar
2 Answers
+ 8
Typdef is also a way you can do this. Type def is not actually creating new data type but it rename another data type to custom type. Syntax : typedef data-type name; For example : You want to create int type data type then you can use it like : typedef int my_datatype;
7th May 2019, 3:50 PM
Raj Chhatrala
Raj Chhatrala - avatar
+ 2
Thanks so much!
7th May 2019, 2:46 PM
Noverdi Ramadhan
Noverdi Ramadhan - avatar