C & C++

programming   /   Coding

C is a general-purpose, procedural programming language developed by Dennis Ritchie between 1969 and 1973 at Bell Labs. It has since become one of the most widely used programming languages of all time.C does no support polymorphism, encapsulation, and inheritance which means that C does not support object oriented programming.




C++ was developed by Bjarne Stroustrup in 1979.C++ supports polymorphism, encapsulation, and inheritance because it is an object oriented programming language.C++ is a powerful, high-performance programming language that extends the C programming language with object-oriented features.C++ has been influential in the software development industry and is widely used in various applications, from systems software to game development.

Overview About 'C' -

  • For the development of code, C supports procedural programming.
  • Data and functions are separated in C because it is a procedural programming language.
  • C does not support information hiding.
  • Built-in data types is supported in C.
  • C is a function driven language because C is a procedural programming language.
  • Function and operator overloading is not supported in C.
  • C is a function-driven language.
  • Functions in C are not defined inside structures.
  • Namespace features are not present inside the C.
  • Standard IO header is stdio.h.
  • Reference variables are not supported by C.
  • Virtual and friend functions are not supported by C.
  • C does not support inheritance.
  • Instead of focusing on data, C focuses on method or process.
  • C provides malloc() and calloc() functions for dynamic memory allocation, and free() for memory de-allocation.
  • Direct support for exception handling is not supported by C.
  • scanf() and printf() functions are used for input/output in C.
  • C structures don’t have access modifiers.
  • There is no strict type checking in C programming language.
  • C does not support overloading
  • Named initializers may appear out of order
  • There are 32 keywords in the C

Overview About 'C++' -

  • C++ is known as hybrid language because C++ supports both procedural and object oriented programming paradigms.
  • Data and functions are encapsulated together in form of an object in C++.
  • Data is hidden by the Encapsulation to ensure that data structures and operators are used as intended.
  • Built-in & user-defined data types is supported in C++.
  • C++ is an object driven language because it is an object oriented programming.
  • Function and operator overloading is supported by C++.
  • C++ is an object-driven language
  • Functions can be used inside a structure in C++.
  • Standard IO header is iostream.h.
  • Reference variables are supported by C++.
  • Virtual and friend functions are supported by C++.
  • C++ supports inheritance.
  • C++ focuses on data instead of focusing on method or procedure.
  • C++ provides new operator for memory allocation and delete operator for memory de-allocation.
  • Exception handling is supported by C++.
  • cin and cout are used for input/output in C++.
  • C ++ structures have access modifiers.
  • Strict type checking in done in C++. So many programs that run well in C compiler will result in many warnings and errors under C++ compiler.
  • Type punning with unions is undefined behavior (except in very specific circumstances)
  • Named initializers must match the data layout of the struct
  • Meta-programming: templates (macros are still supported but discouraged)

C provides direct access to memory and system resources through the use of pointers, which allows for highly efficient and performance-critical programming. The language is designed to have minimal runtime overhead, making it ideal for system-level programming and applications where performance is crucial.

C++ introduces the concepts of classes and objects, enabling you to model real-world entities, which promotes code reuse and modularity.Bundles data and functions that operate on the data within a single unit, protecting the integrity of the data.Allows the creation of new classes based on existing ones, facilitating code reuse and the creation of hierarchical relationships. Provides the ability to call different functions using the same interface, enhancing flexibility and integration.