Jump To Content

LearnHub




Difference between c and c++

Join Communities


Enhance your Writing Skills

Become a Photographer

Handigifts

Learn about
Jazz & More

Love the Art
  • C does not have any classes or objects. It is procedure and function driven. There is no concept of access through objects and structures are the only place where there is a access through a compacted variable. c++ is object oriented.
  • C structures have a different behaviour compared to c++ structures. Structures in c do not accept functions as their parts.
  • C input/output is based on library and the processes are carried out by including functions. C++ i/o is made through console commands cin and cout.
  • C functions do not support overloading. Operator overloading is a process in which the same function has two or more different behaviours based on the data input by the user.
  • C does not support new or delete commands. The memory operations to free or allocate memory in c are carried out by malloc() and free().
  • Undeclared functions in c++ are not allowed. The function has to have a prototype defined before the main() before use in c++ although in c the functions can be declared at the point of use.
  • After declaring structures and enumerators in c we cannot declare the variable for the structure right after the end of the structure as in c++.
  • For an int main() in c++ we may not write a return statement but the return is mandatory in c if we are using int main().
  • In C++ identifiers are not allowed to contain two or more consecutive underscores in any position. C identifiers cannot start with two or more consecutive underscores, but may contain them in other positions.
  • C has a top down approach whereas c++ has a bottom up approach.
  • In c a character constant is automatically elevated to an integer whereas in c++ this is not the case.
  • In c declaring the global variable several times is allowed but this is not allowed in c++.

  1. BobbyGoks saidFri, 07 Nov 2008 14:37:26 -0000 ( Link )

    Nice points.
    Some errors should be corrected to avoid confusions. ex: ‘elevated to and integer’ which should be ‘elevated to an integer’.

    Examples could be added for points to facilitate understanding.

    Actions
    Vote
    Current Rating
    0
    Rate Up
    Rate Down
    No Votes

    Post Comments

  2. deepa mittal saidMon, 10 Nov 2008 05:47:10 -0000 ( Link )

    abc

    Actions
    Vote
    Current Rating
    1
    Rate Up
    Rate Down
    1 Total Vote

    Post Comments

  3. jeevanpreddy saidFri, 09 Jan 2009 04:53:28 -0000 ( Link )

    ya nice points but if u could have explain about all oop features then it will be easy to get the diff …

    Actions
    Vote
    Current Rating
    0
    Rate Up
    Rate Down
    No Votes

    Post Comments

  4. ckckumar saidSat, 26 Sep 2009 09:00:35 -0000 ( Link )

    superb points. But overloading functions is called function overloading and not operator overloading. functon overloadsing is also called function polymorphism

    Actions
    Vote
    Current Rating
    1
    Rate Up
    Rate Down
    1 Total Vote

    Post Comments

  5. Dev_Swapnil saidWed, 27 Jan 2010 06:28:46 -0000 ( Link )

    in C global variables must be initialize in compile time, ex.
    int g_iData = printf(“In C”);
    int main()
    {
    }

    is not allowed but this is allowed in CPP.

    Regads,
    Swapnil

    Actions
    Vote
    Current Rating
    1
    Rate Up
    Rate Down
    1 Total Vote

    Post Comments

  6. dinem saidTue, 09 Feb 2010 05:12:38 -0000 ( Link )

    yeah it’s nice but if you give some more detailed about the concepts it will be easier to understand for beginners!!!!!!!!

    Actions
    Vote
    Current Rating
    1
    Rate Up
    Rate Down
    1 Total Vote

    Post Comments

  7. mrb_cse saidFri, 19 Mar 2010 15:26:00 -0000 ( Link )

    char f1();
    char f1(void);

    Actions
    Vote
    Current Rating
    1
    Rate Up
    Rate Down
    1 Total Vote

    Post Comments

  8. zaphire saidWed, 01 Jun 2011 11:20:22 -0000 ( Link )

    its very helpful..
    but i still hav doubts..!!
    if u wud hav given examples i cud hav understood more easily..

    Actions
    Vote
    Current Rating
    1
    Rate Up
    Rate Down
    1 Total Vote

    Post Comments

  9. palanivelmscit saidMon, 14 Nov 2011 12:45:46 -0000 ( Link )

    this point is very easy reading….. thanking you by palani

    Actions
    Vote
    Current Rating
    1
    Rate Up
    Rate Down
    1 Total Vote

    Post Comments

  10. palanivelmscit saidMon, 14 Nov 2011 12:47:06 -0000 ( Link )

    this point is very easy reading….. thanking you by palani

    Actions
    Vote
    Current Rating
    1
    Rate Up
    Rate Down
    1 Total Vote

    Post Comments

  11. wild111 saidThu, 26 Apr 2012 07:12:09 -0000 ( Link )

    perfect comparision betwwen c and c++.thnx palani

    Actions
    Vote
    Current Rating
    1
    Rate Up
    Rate Down
    1 Total Vote

    Post Comments

  12. hey002 saidThu, 26 Apr 2012 07:26:26 -0000 ( Link )

    perfect comparision betwwen c and c++.thnx palani

    Actions
    Vote
    Current Rating
    1
    Rate Up
    Rate Down
    1 Total Vote

    Post Comments

Your Comment
Textile is Enabled (View Reference)