Solved

C and C++ programming

Posted on 1997-11-13
1
202 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
C++ - Convert a wString to char * 9 513
c++ array loading from DB inheriting previous data when empty 5 59
Getting IP address 8 71
Arduino EDI - Programming language 3 80
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

910 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now