Welcome to C programming! C is a powerful, general-purpose programming language developed by Dennis Ritchie in 1972. It's widely used for system programming, embedded systems, and application development. Here's a basic C program structure with the main function and a simple Hello World example.
C has several fundamental data types. Integers use int and take 4 bytes. Float stores decimal numbers in 4 bytes, while double provides higher precision in 8 bytes. Char stores single characters in 1 byte. Variables are declared by specifying the data type followed by the variable name. You can initialize them with values during declaration.
C provides printf for output and scanf for input. Printf uses format specifiers like percent d for integers. Scanf reads user input using ampersand before variable names. C has arithmetic operators for math operations, relational operators for comparisons, logical operators for boolean logic, and assignment operators for storing values.
Control flow statements direct program execution. If statements execute code when conditions are true, with else if for additional tests and else as fallback. For loops repeat with a counter variable, while loops continue as long as conditions remain true, and do-while loops execute at least once before checking conditions.
Functions break code into reusable modules with return types, names, and parameters. They must be declared before use. Arrays store multiple values of the same type with zero-based indexing. You declare arrays with data type, name, and size in brackets. This example shows a function that adds numbers and an array storing integers.