So is there a point in learning C if I already know C++? |
If you know C++, then you already know 98% of [the rules of] C.
The major differences in C:
1) No operator overloading
2) No function overloading
3) No classes
4) No templates
5) structs exist in a separate namespace:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
struct A
{
//...
};
typedef struct
{
//...
} B;
int main()
{
A a; // compiler error, 'A' does not exist in this namespace
struct A a2; // OK
B b; // OK, the struct is typedef'd to be in this namespace
}
|
There are a few other differences, but really, that's kind of it.
The biggest part about "learning C" is style differences. Just because you know the language rules doesn't mean you know how to use them properly.
I have heard that if you write C code in a C++ compiler it will run fine, but not the other way around. Is this true? |
A lot of the time, yes that's true. C++ is mostly backwards compatible with C. However it is very possible to write C code that will not compile as C++... usually by using a C++ keyword as a variable name or something.
On the internet I have heard people saying that PHP is interpreted by C |
That depends on the software doing the interpreting.
and has similar syntax to C. Is this true also? |
C++, C#, PHP, Java, Javascript, D, and about a dozen other languages all have "C-like" syntax.