- Implicit assignment from void*: in C, is ok; in C++, not safe, cannot compile
- Freeing arrays: in C, use malloc and free for single elements and arrays; in C++, you much match calls to new/delete, new[]/delete[]
- Functions must be decleared before use
- struct: in C, you have to include keyword struct in order to declear a struct_instance; in C++, you don't have to do so.
- C++ has a much larger library: sometimes you want to compile a math heavy computation program, you could use gcc foo.c -lm/g++ foo.cc
- C didn't provide a boolean type, you could use enum to define.
- C++ may automatically add return 0 at the end of the main(); however in C you have to do it yourself.
- C requires define all the variables before a block of codes; C++ not necessary.
Saturday, February 10, 2007
Where C/C++ differ?
Subscribe to:
Posts (Atom)