C

programming languages

C

A System Programming Language

C is one of the oldest and most influent programming language. It is famous for the simplicity, efficiency, and versatility. The programming language was developed in the early 1970s, C is old, despite that it remains fundamental, with a wide range of applicants.

Basic Sintax

  • Variables
int my_var = 42

or

  • Functions
int add(x, y int) {
    return x + y;
}
  • Comments
// this is a single-line comment

/* this is a
multi-line 
comment
*/

Pros

  1. Efficiency: C offers a high level of control over system resources and memory.
  2. Portability: the programs are highly portable, and code written in C can run on different platforms with minimal modification.
  3. Versatility: it can be used in different applications.
  4. Extensive Standard Library: the STL provides functions for common tasks like io, string manipulation, and math operations.
  5. Widely Taught and Used: the programming language is widely used in industry.

Cons

  1. Lack of Modern Abstractions: The programming language lacks modern abstraction and features found in more modern languages.
  2. Manual Memory Management: C requires manual memory management, which can lead to bugs like memory leaks and pointer errors, if not handled carefully.
  3. No Built-in Support for Multithreading: also lacks built-in support for multithreading and concurrent programming.

Minimal program

#include <stdio.h>

int main(){
    printf("Hello, World!");
    return 0;
}

Basic hello world

The basic hello world is the equal to the minimal program to write in C.

#include <stdio.h>

int main(){
    printf("Hello, World!");
    return 0;
}
0%