Structure in C verses cpp

1>In C: structure is just data container.

In C++: structure is almost identical to class. There is only one difference between structure and class in C++ : data members in structure are by default public, and in class they are by default private.

2>In c structure
~we can not have access specifiers
~can not contain functions
But in c++
~we can specify data as a public , private and protected

The syntax for using a struct is different in C than C++:

In C++ struct is a type, and can be referred to much like an int. Not so in C.
Actually it is also a type, except that you have to prefix every use
of the name with the  keyword “struct” unless you declare it as a
typedef.

Links:

Structure Padding

Resolving technical problems:

Solve your technical problems instantly

We provide Remote Technical Support from Monday to Sunday, 7:00PM to 1:00 AM

Mail your problem details at writeulearn@gmail.com along with your mobile numberand we will give you a call for further details. We usually attend your problems within 60 minutes and solve it in maximum 2 days.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.