You are here:

C++/C++ an appetite


Just 2 questions:
-- Can everything that can possibly be done in C(like the low level stuff and the likes) be done in C++, and vice versa?
-- Can I use any C code in my C++ program, and vice versa?


I just re-read my answers and I realised that for your:

   "Can I use any C code in my C++ program, and vice versa?"

query I answered only for using C and C++ source code with the other language's compilers (e.g. compiling C++ code with a C compiler).

I should have mentioned that you can easily call compiled C functions from C++ and, usually, with a bit of care you can call compiled C++ functions from C. That is C++ can access C APIs and you can create C APIs using C++.

Also you will quite often find that compilers are C/C++ and can compile code as C or C++ [e.g. Microsoft Visual C++, GNU compiler collection (which supports more than just C and C++) - especially the gcc and g++ build tool drivers]

-- end followup

Can everything that can possibly be done in C(like the low level stuff and the likes) be done in C++,
Pretty much yes.

and vice versa?
Pretty much yes.

BUT the way you would solve a given problem would most likely be different in C++ than C, especially for larger projects.

Also C++ programs may require a bit more runtime support than C programs - see the ISO C++ committee's draft report on C++ performance for details:

Can I use any C code in my C++ program,
No, but a great deal of valid C code is also valid C++.

There are differences though such as:

   - C assumes an int return type for functions that specify none, in C++ this is illegal,
     a function must explicitly specify a return type.
   - in C a function need not have been declared before it is called, in C++ this is illegal.
   - Very old C code (pre ISO/ANSI standard C) may use syntax not supported by C++.
   - C++'s C features are based on the C 1990 ISO standard (or maybe one of the minor updates after that) and _not_
     the newer C 1999 ISO standard

and vice versa?
No. C++, in general can be considered a superset of C (C90), although, as mentioned above, this is not 100% true.

For more information please use an Internet search engine - there is a lot of information out there! E.g. see the C++ FAQ on Dr. Bjarne Stroustrup's site:

There is a section on C and C++.


All Answers

Answers by Expert:

Ask Experts


Ralph McArdell


I am a software developer with more than 15 years C++ experience and over 25 years experience developing a wide variety of applications for Windows NT/2000/XP, UNIX, Linux and other platforms. I can help with basic to advanced C++, C (although I do not write just-C much if at all these days so maybe ask in the C section about purely C matters), software development and many platform specific and system development problems.


My career started in the mid 1980s working as a batch process operator for the now defunct Inner London Education Authority, working on Prime mini computers. I then moved into the role of Programmer / Analyst, also on the Primes, then into technical support and finally into the micro computing section, using a variety of 16 and 8 bit machines. Following the demise of the ILEA I worked for a small company, now gone, called Hodos. I worked on a part task train simulator using C and the Intel DVI (Digital Video Interactive) - the hardware based predecessor to Indeo. Other projects included a CGI based train simulator (different goals to the first), and various other projects in C and Visual Basic (er, version 1 that is). When Hodos went into receivership I went freelance and finally managed to start working in C++. I initially had contracts working on train simulators (surprise) and multimedia - I worked on many of the Dorling Kindersley CD-ROM titles and wrote the screensaver games for the Wallace and Gromit Cracking Animator CD. My more recent contracts have been more traditionally IT based, working predominately in C++ on MS Windows NT, 2000. XP, Linux and UN*X. These projects have had wide ranging additional skill sets including system analysis and design, databases and SQL in various guises, C#, client server and remoting, cross porting applications between platforms and various client development processes. I have an interest in the development of the C++ core language and libraries and try to keep up with at least some of the papers on the ISO C++ Standard Committee site at


©2017 All rights reserved.