Difference between "C structure" and "C++ structure".

Questions by suji   answers by suji

Showing Answers 1 - 19 of 19 Answers

Neetu Agrawal

  • Sep 25th, 2005
 

C structures contain only data members where as c++ structure contains both data members and member functions as well.

Johnny

  • Oct 23rd, 2005
 

They are different. C struct can only contain data while C++ struct can contain functions and access limitation such as public, private etc just as a class (not totally the same as class!)

Vijay

  • Jan 2nd, 2006
 

Default behaviour of members in c Structures is public and in c++ structures is private. 

chandrasekhar

  • Jan 17th, 2006
 

The main difference is that c++ has bottom ot top approach and c has top to bottom approach.

  Was this answer useful?  Yes

Peter

  • Mar 1st, 2006
 

in c++, the default structure members are public and private for class.

  Was this answer useful?  Yes

Priti Kamath

  • Sep 12th, 2006
 

C++ and C structs are REALLY different

1)C++ structs are like C++ class except the default access for struct is public v/s class is private

2) C struct can have integral data type only unlike C++ struct that can also have member functions

3) C struct cannot have access scope like public, private, protected, but C++ struct can.

4) struct A{ int i, int j } ; typedef A A1; typedef needed for C struct and not required for C++ , A can be directly accessed.

keerthi

  • Mar 26th, 2007
 

in c structure data are not intialised with in the structure where as in c++ intialisation is done through constructor.

wow_suraj

  • May 7th, 2008
 

Difference between 'C structure' and 'C++ structure' is that the structure in case of 'C' will only hold data definition, whereas structure in 'C++' will contain both data definition and functions.

  Was this answer useful?  Yes

samitriani

  • Jul 8th, 2008
 

C does not have limitation access. Structures in C are used to regroup data from different types.

In C++ structure have limitation access propreties (private,public protected) with public access as default, can contain methods and can be used as a class.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions