Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

C and C++ programming

Posted on 1997-11-13
1
207 Views
Last Modified: 2010-04-10
I am new user of C++ programming. How the C are differ from C++ program. I hope it will be specify in following aspects;
filename, program structure, data type, function, expression, control structure and operator.
0
Comment
Question by:feda
1 Comment
 
LVL 5

Accepted Solution

by:
yonat earned 100 total points
ID: 1173144
C++ includes most of C. It adds two major features, and several minor enhancements. The two major additions are:
1. Support for object oriented programming (classes and virtual functions).
2. Support for generic programming (templates).
Other enhancements include exception handling (which has been also added to C9x), stronger typing, inline functions, namespaces, standard specification of linkage (eg extern "C") etc.
The C++ standard library includes the C standard library, and adds much more, including the iostream library and STL.

About the aspects you mentioned:
1. Filename - no difference. In both C and C++ the filenames depend on the underlying operating system.

2. Program structure - C supports structured programming (separating the program to functions), while C++ supports also object oriented programming (separating the program to classes and objects) and generic programming (separating the program to templates).

3. Data type - the basic types are the same: int, char etc. However, in C++ you can define new types (classes) that behave like built-in types. In C, you can only define "dumb" structs.

4. Function - both languages support functions in the same way. C++ adds inline function support.

5. Expression - the expression syntax is the same in both languages.

6. Control structure - Both languages have the same control structures. There is only a slight difference in the usage of "for".

7. Operator - Both languages have the same operators. However, C++ allows you to define operators for your own types (classes), and make them behave as-if they were built-in types. For example, you can define a class Complex, and define operators +, - and * for it.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Dialogbox API leak? 18 98
White board coding practice 3 90
Unable to start eclipse ? 17 153
Precision Problem in C++ 7 44
Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question