FANDOM


C vs C++Edit

There are many differences in C and C++, the following is a list of many of these differences

  • A void pointer cannot be implicitly casted to another pointer (eg. char *buf = malloc(10) must be changed to char *buf = (char*)malloc(10) )
  • A C typedef does not allow duplicate names, but C++ does
  • All C enums are of int, but C++ enums do not have to
  • C++ has a built in bool type with true and false
  • In both C and C++, the function void foo (void) means the function takes no parameter. However, in C, the function void foo () means the function takes unspecified number of parameters with unspecified types, while in C++ it means the function takes no parameter.