+ 1
What is user defined data type . How it help in programming? Any one please explain with example.😊
3 Respuestas
+ 4
User-defined data types are a common feature in BASIC programming and are used to support database, file read/write, and print operations. A user-defined data type lets you group data of different types in a single variable. This data type can contain any kind of related information you want to store and use together, such as personnel information, company financial information. A variable of a user-defined data type holds actual data, not a pointer to that data.
The syntax is :
[ Public | Private ] Type typeName
member variable declarations
+ 1
a user defined type in c# is a class or a struct. It is a composition of standard data types.
this is the class
class Box
{ public double length; // Length of a box public double breadth; // Breadth of a box public double height; // Height of a box
}
to create a instance of the class
Box Box1 = new Box;
https://www.tutorialspoint.com/csharp/csharp_classes.htm
use of struct
struct Simple
{
public int Position;
public bool Exists;
public double LastValue;
};
static void Main()
{
// ... Create struct on stack.
Simple s;
s.Position = 1;
}
https://www.dotnetperls.com/struct
+ 1
Most of the programming languages we have provide us with the functionality of built in data type to represent our data. But in some case we might want to define our own data type to represent group of built in data types. For example to create objects or structs