@Dalisto1 It _IS_ a requirement if you're writing a C or a C++ program -- since those languages are _defined_ by their respective standards (ISO 9899 and ISO 14882, respectively). Perhaps you are using some different programming language that allows you to write "void main" and your particular compiler compiles it. But for the rest of the world it's irrelevant -- only what the ISO standard say is relevant. See also discussion watch?v=7AZhjQjYX9w that starts at 30:40.
@Dalisto1 No, it's always "int main", according to the ISO/IEC 14882 C++ standard (the document that _defines_ C++ -- it's absolutely irrelevant what happens to work or not in your compiler), see ISO C++ standard 3.6.1[2] or the ISO C standard 5.1.2.2.1 (yes, same goes for C).
@Xemerau is right ..but is NO SENSE implement a dinamic struct as a Lista or a tree with a struct. you can do it in C normally. C++ is O.O. so you have to do data abstract and create methods that update write or read attributes. That is what C++request!! save your data (creating them private...and use own methods to modelling them..)
is not C++ man u are developt a node in C in C++ u have to use the class node..and u haveto declaration all the attributes private and public all the methods uses attributes....
@Asterisko90 structs are still a viable data structure in c++. Structs are like classes except that a struct's data is public by default, whereas a class's is private. In addtion, you do not have to declare all of a classes members/member functions as private or public. If you don't however, they will be private by default.
@Peterolen No there isn't much of an advantage. Except you should try to learn how to make Linked list manually without using STD or Standard Library Templates, because thats what they will make you do in job interviews.
@Dalisto1 It _IS_ a requirement if you're writing a C or a C++ program -- since those languages are _defined_ by their respective standards (ISO 9899 and ISO 14882, respectively). Perhaps you are using some different programming language that allows you to write "void main" and your particular compiler compiles it. But for the rest of the world it's irrelevant -- only what the ISO standard say is relevant. See also discussion watch?v=7AZhjQjYX9w that starts at 30:40.
mattpdz 2 months ago
@Dalisto1 Also, Google for "[29.3] Should I use void main() or int main()?" -- this should resolve your remaining doubts; hope that helps!
mattpdz 2 months ago
@Dalisto1 No, it's always "int main", according to the ISO/IEC 14882 C++ standard (the document that _defines_ C++ -- it's absolutely irrelevant what happens to work or not in your compiler), see ISO C++ standard 3.6.1[2] or the ISO C standard 5.1.2.2.1 (yes, same goes for C).
mattpdz 2 months ago
@Xemerau is right ..but is NO SENSE implement a dinamic struct as a Lista or a tree with a struct. you can do it in C normally. C++ is O.O. so you have to do data abstract and create methods that update write or read attributes. That is what C++request!! save your data (creating them private...and use own methods to modelling them..)
Asterisko90 4 months ago
is not C++ man u are developt a node in C in C++ u have to use the class node..and u haveto declaration all the attributes private and public all the methods uses attributes....
Asterisko90 4 months ago
@Asterisko90 structs are still a viable data structure in c++. Structs are like classes except that a struct's data is public by default, whereas a class's is private. In addtion, you do not have to declare all of a classes members/member functions as private or public. If you don't however, they will be private by default.
Xemerau 4 months ago
Note: It's "int main", NOT "void main" ("void main" is not standard-compliant).
mattpdz 4 months ago
Is there any advantage with this method compared to using std::list?
Peterolen 5 months ago
@Peterolen No there isn't much of an advantage. Except you should try to learn how to make Linked list manually without using STD or Standard Library Templates, because thats what they will make you do in job interviews.
cac89 5 months ago 2