Post

Fundamentals of C

Fundamentals of C

C Programming

What is C?s

C is a general-purpose programming language created by Dennis Ritchie in 1972 at Bell Labs. It is fast, powerful, and forms the foundation of many modern languages. C is closely tied to the development of UNIX.


Constants

Constants are fixed values that do not change during program execution. They can be Primary (integer, floating-point, character) or Secondary (string, array, pointer, enum, struct, macro).


Variables

Variables are named memory locations used to store data. They can hold constants such as integers, characters, or floating-point numbers. Example:

1
int age = 25;

Data Types

Data types define the type and size of data a variable can store. Examples: int (4 bytes), float (4 bytes), double (8 bytes), char (1 byte), void (no value).


Operators

Operators are symbols that perform operations on variables and values. Main categories include:

  • Arithmetic
  • Assignment
  • Comparison
  • Logical

Header File Libraries

Header files contain function declarations, macros, and definitions. They allow you to use built-in functions like printf() without writing them yourself. Example: <stdio.h> for input/output functions.


Hello World Program

1
2
3
4
5
6
#include <stdio.h>

int main() {
    printf("Hello World!");
    return 0;
}
This post is licensed under CC BY 4.0 by the author.