Difference between C and C#

Key difference: C and C# are two different computer programming languages. C was originally developed by Dennis Ritchie at AT&T Bell Labs between 1969 and 1973. It has a free-format program source code. C#, also known as C sharp, is an object oriented programming language. C# is a multi-paradigm programming language. C# is based on the C programming language. It was originally developed by Anders Hejlsberg for Microsoft for use in its .NET framework.

C and C# are two different computer programming languages. C was originally developed by Dennis Ritchie at AT&T Bell Labs between 1969 and 1973. It has a free-format program source code. C is a general-purpose programming language that uses semicolon (;) as a statement terminator, as well as curly braces ({}) for grouping blocks of statements.  It has facilities for structured programming and its design provides constructs that can map efficiently to typical machine instructions.  It also allows lexical variable scope and recursion and has a static type system, which prevents many unintended operations.

C is one of the oldest currently used programming languages and is one of the most widely used programming languages. It has been constantly used in applications that had previously coded in assembly language. This includes the UNIX computer operating system.

C has directly or indirectly influenced a lot of the later programming languages, such as C#, D, Go, Java, JavaScript, Limbo, LPC, Perl, PHP, Python, and Unix's C shell. Despite all these new languages, C still remains a popular programming language.

C#, also known as C sharp, is an object oriented programming language. C# is a multi-paradigm programming language. It includes strong typing, imperative, declarative, functional, procedural, generic, object-oriented (class-based), and component-oriented programming disciplines.

C# is based on the C programming language. It was originally developed by Anders Hejlsberg for Microsoft for use in its .NET framework. The C# language was later approved as a standard by Ecma (ECMA-334) and ISO (ISO/IEC 23270:2006). C# is one of the programming languages designed for the Common Language Infrastructure. C# is intended to be a simple, modern, general-purpose, object-oriented programming language.

The design goals for C#, as listed by the ECMA standard:

  • The C# language is intended to be a simple, modern, general-purpose, object-oriented programming language.
  • The language, and implementations thereof, should provide support for software engineering principles such as strong type checking, array bounds checking, detection of attempts to use uninitialized variables, and automatic garbage collection. Software robustness, durability, and programmer productivity are important.
  • The language is intended for use in developing software components suitable for deployment in distributed environments.
  • Source code portability is very important, as is programmer portability, especially for those programmers already familiar with C and C++.
  • Support for internationalization is very important.
  • C# is intended to be suitable for writing applications for both hosted and embedded systems, ranging from the very large that use sophisticated operating systems, down to the very small having dedicated functions.
  • Although C# applications are intended to be economical with regard to memory and processing power requirements, the language was not intended to compete directly on performance and size with C or assembly language.

As it based on the C language, it is quite similar to it. It even shares some syntactic conventions with C. However, a disadvantage of C# is that, as it was developed by Microsoft for use in its .NET framework, it only works on Microsoft operating systems.

Further differences between C and C#:

  • C is unmanaged code, and C# is managed by the .NET CLR (Common Language Runtime)
  • C# is an object orienated language. C is a structed language.
  • C can be executed in cross-platform environments. While, C# requires the .NET Framework in order to execute.
  • C is more on functions, whereas C# is more on the designs.
  • In C# Garbage collection is done by CLR, while in C its not.
  • C supports pointers but C# does not.

Image Courtesy: gointerviews.com, codesmesh.com

Most Searched in Electronics Most Searched in Society and Culture
Most Searched in Pregnancy and Parenting Most Searched in Sports
TFT vs LCD
Board of Directors vs Management
Pong vs Ping Pong
Antivirus vs Firewall Software

Add new comment

Plain text

CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.