What is the Difference between "C structure" and "C++
structure"?

Answer Posted / satsen singh

C Structure :-
1. Only variables of different data types can be declared, functions are not allowed
2. Direct access to data members is possible
3. ‘struct’ data type is not treated as built in type – use of ‘struct’ necessary to declare objects
4. Member variables cannot be initialized inside a structure

C++ Structure :-
1. In C++ structure declaration functions can also be declared
2. The members declared in a C++ structure is public by default
3. While declaring an object the keyword ‘struct’ is omitted in C++

Is This Answer Correct ?    26 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How much is c++ certification?

774


Where the memory to the static variables is allocated?

779


If a base class declares a function to be virtual, and a derived class does not use the term virtual when overriding that class, is it still virtual when inherited by a third-generation class?

821


Can I uninstall microsoft c++ redistributable?

792


Why we use #include conio h in c++?

794


What does obj stand for?

844


What is the difference between reference and pointer?

842


What are shallow and deep copy?

845


How do you establish a has-a relationship?

816


What are the benefits of pointers?

787


Are there interfaces in c++?

750


What is the header file for setw?

812


What are the different types of comments allowed in c++?

787


Is map thread safe c++?

858


What is abstraction c++?

786