PROGRAMMING C











C Programming (Turbo C++ Compiler) - Struct


You can have multiple data members of various types in C Language structures. You can not have any functions with in a struct in C Language. Similarly in unions also, you can not have any function. This feature in only available in C++.

Note that all the members in struct can be accessed by any function. There is no concept of private, public, protected in C language. These are all the features of C++.

Source Code



struct MyClass
{
int m;
int a;
int b;
double d; char dname[24];
};

Output