Programming in C – Notes
Browse topic-wise notes, syntax, and examples for the C language.
← Back to C LanguageIntroduction to C
C is a general-purpose, procedural programming language developed by Dennis Ritchie at Bell Laboratories in 1972. It is designed for system programming and is widely used in operating systems, embedded systems, and application development.
- Developed in 1972 by Dennis Ritchie
- Based on BCPL and B languages
- ANSI C standardized in 1989 (C89/C90)
- Updated standards: C99 (1999), C11 (2011), C17 (2017)
Features of C
- Simple: Easy to learn and understand
- Portable: Code runs on different platforms with minimal changes
- Efficient: Fast execution speed
- Low-level Access: Direct memory manipulation
- Rich Library: Large collection of built-in functions
- Modular: Supports functions and code reusability
- Structured: Supports structured programming
Structure of a C Program
// Preprocessor directives
#include <stdio.h>
#define MAX 100
// Global declarations
int global_var = 10;
// Function prototypes
void function_name();
// Main function
int main() {
// Local declarations
int local_var = 20;
// Executable statements
printf("Hello, World!\n");
return 0; // Return statement
}
// Function definitions
void function_name() {
// Function body
}A C program typically consists of preprocessor directives, global declarations, function prototypes, the main function, and function definitions.