C
programming languages
Contents
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
- Efficiency: C offers a high level of control over system resources and memory.
- Portability: the programs are highly portable, and code written in C can run on different platforms with minimal modification.
- Versatility: it can be used in different applications.
- Extensive Standard Library: the STL provides functions for common tasks like io, string manipulation, and math operations.
- Widely Taught and Used: the programming language is widely used in industry.
Cons
- Lack of Modern Abstractions: The programming language lacks modern abstraction and features found in more modern languages.
- Manual Memory Management: C requires manual memory management, which can lead to bugs like memory leaks and pointer errors, if not handled carefully.
- 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;
}