+ 1
what is the structure of a programm
how is a working programm build
1 Réponse
+ 4
Did you mean structures ?
structured are only in c++ not java .
Structures are user defined data types that are used to declare multiple variable that can be accessed by a single parent for example let's consider a structure :
struct Profile {
char name[50];
int age;
short d,y,m;
char gen; // You can't declare the value for any member here . It will give an error
};
This structure is declare above the main. You can even declare it below the main but then you need
to first call it above the main() .Like : struct Profile;
This is almost similar to a function .
If you want to access any of the data members you can use : it like
int main() {
Profile p1; // To create an object
cin>>p1.age;
cout<<p1.age;
... and so on
return 0;
}
For an example program see this :
https://code.sololearn.com/cmrgGee0jPrl/?ref=app