Home  >  Article  >  Backend Development  >  What are the differences between C and C++?

What are the differences between C and C++?

WBOY
WBOYforward
2023-08-29 09:17:061860browse

What are the differences between C and C++?

Here are some differences between C and C.

  • Compared with C, C is a subset of C. All valid C programs are valid C programs.
  • C is a structured or procedural programming language, while C is an object-oriented programming language.
  • In C, functions are the basic building blocks, and in C, objects are the basic building blocks.
  • C does not have variable references, while C has variable references.
  • C uses malloc and free for memory allocation, while C uses new and delete for memory allocation.
  • C does not provide direct error handling support, but C supports exception handling, which helps error detection and smooth processing.
  • C does not support function and operator overloading, while C supports function and operator overloading.
  • C does not support generic programming, but templates in C allow writing generic programs.
  • C does not support namespaces, but C supports namespaces.

The above is the detailed content of What are the differences between C and C++?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete
Previous article:C program to find changeNext article:C program to find change