What are the differences between C & C++??

This is a discussion on What are the differences between C & C++?? within the C++ Programming forums, part of the General Programming Boards category; what features make better C++ from C? Why many programs that were used in C, do not work in C++? ...

  1. #1
    Registered User
    Join Date
    Apr 2002
    Posts
    9

    Question What are the differences between C & C++??

    what features make better C++ from C?
    Why many programs that were used in C, do not work in C++?

    any more features.. please give me details. i need to make a essay about it.
    Last edited by moenia; 04-29-2002 at 01:48 PM.

  2. #2
    Pygmy Monkey ErionD's Avatar
    Join Date
    Feb 2002
    Posts
    408
    Three words: Object Oriented Programming

  3. #3
    Registered User
    Join Date
    Dec 2001
    Posts
    108

    Re: What are the differences between C & C++??

    Originally posted by moenia
    what features make better C++ from C?
    Why many programs that were used in C, do not work in C++?

    any more features.. please give me details. i need to make a essay about it.
    What makes C++ better than C is that a struct/class can have member functions as well as member data.

    Many programs written in C can directly map to C++, just move the variables and functions into a C++ class/struct.

  4. #4
    Registered User Dual-Catfish's Avatar
    Join Date
    Sep 2001
    Posts
    802
    I think this would be best answered by: http://www.cprogramming.com/cboard/s...&threadid=5352

  5. #5
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,493
    there are some details that that thread doesn't cover.

    there is object oriented programming. c provides structs to organize a group of variables into a coherent block. c++ provides classes to make that coherent block self-dependant, work well with other blocks, derive details from base classes, and have the general look to programmers of an object meant for a specific task.

    and then there are details:
    • some optional but recommended features of c are required in c++, like function prototypes.
    • c++ uses stream input/output to make life easier. (or in my case, harder). c requires a weird syntax to get that level of flexibility.
    • c++ has vector arrays and string classes. the string class is a flexible version of c strings. it can be incremented, inserted, searched, or deleted at will without the need for extra garbage collection (on the programmers part). vector arrays are arrays of anything, but these arrays can be incremented, deleted, sorted, searched, etc... do a search on stl to find out more.
    • c++ has less need for defines. i forget why, but it has something to do with const variables...
    • c++ has a more flexible syntax:
      Code:
      for (int i=0;i<8;i++)
      wouldn't be allowed in C. neither would this(in some cases):
      Code:
      int c=3;

    there's probably other stuff too, why not ask more detailed questions?
    Last edited by ygfperson; 04-29-2002 at 07:30 PM.

  6. #6
    In The Light
    Join Date
    Oct 2001
    Posts
    598
    howdy,
    read "The Design and Evolution of C++" by Bjarne Strostrup ISBN0-201-54330-3...
    it kind of reads like a dictionary but my feeble mind loved every minute of it

    M.R.
    I don't like you very much. Please post a lot less.
    Cheez
    *and then*
    No, I know you were joking. My point still stands.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. compiler differences
    By BEN10 in forum C Programming
    Replies: 39
    Last Post: 04-01-2009, 05:56 AM
  2. stdio differences windows vs linux
    By keira in forum C Programming
    Replies: 6
    Last Post: 09-14-2008, 04:42 PM
  3. differences between images
    By ^DJ_Link^ in forum C Programming
    Replies: 2
    Last Post: 02-21-2005, 07:03 AM
  4. differences between Borland and Microsoft
    By Visual Studio in forum C Programming
    Replies: 7
    Last Post: 12-03-2002, 03:47 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21