The enviornment/makefile is setup to build both C and C++. Just wondering if this is common to use C code in a C++ file or if it is not something someone should do.
Thanks!
Can you use C code in a C++ file?
C++ is C language + object programming.
So when you are programming in C++, you are using an object which call (in an other file) some premade C language.
So yeah you can and withouth knowing you are doing it...
int i=1 is C code... can you program in C++ without using C?? No!
Reply:Yes, it is. C is a subset of C++, so most things valid in ANSI C work fine in C++ (if you are using an ANSI compiler; most are). I often use C when using C++, I mainly use C++ for classes, I do everything else in standard C library.
Reply:Yeah but it's the library that differs on most compilers.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment