Can we call structure without creating object? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can we call structure without creating object?

need to invoke the structure without creating object

12th Oct 2016, 4:38 AM
Joshna Reddy
Joshna Reddy - avatar
2 Answers
0
you can not call structure or class you can only access the member functions or data member of it. For accessing in case of structure you need to create a structure variable using which you can access its members you can also use pointer to the structure. for example: struct Student{ char name[20]; int age; }StructureVariable; int main() { //accessing the structure member StructureVariable.age=10; cout<<StructureVariable.age; return 0; }
12th Oct 2016, 6:36 AM
Prabhakar Jha
Prabhakar Jha - avatar
0
structure is a data type u can't CALL INT
12th Oct 2016, 4:06 PM
Kamal Singh
Kamal Singh - avatar