C Tutorial

C is the language underneath operating systems, embedded devices and many other languages. Learning it teaches you how a computer actually runs your code. The track covers the GATE "Programming in C" syllabus, and most lessons end with GATE-style questions whose programs were compiled and run to check every answer.

Start the first lesson

1Getting Started

  1. Your First C ProgramWhat C is, how a C program is compiled, and the classic hello program.
  2. Variables and Data TypesDeclare variables with a type and learn how C stores numbers and characters.
  3. OperatorsArithmetic, comparison, logical and increment operators in C.
  4. Bitwise OperatorsWork directly with the bits of integers using &, |, ^, ~, << and >>.
  5. Input and OutputRead numbers and text from the keyboard with scanf and format output with printf.

2Control Flow

  1. Decisions with if and switchChoose between paths with if, else if, else and switch.
  2. Loops in CRepeat work with for, while and do-while loops.

3Functions

  1. Functions in CSplit a program into small functions with parameters and return types.
  2. RecursionSolve problems with functions that call themselves.
  3. Scope and Storage ClassesWhere a variable is visible, how long it lives, and what auto, static, extern and register mean.

4Arrays and Strings

  1. ArraysStore many values of the same type in one variable.
  2. StringsWork with text as arrays of characters and use the string.h functions.

5Pointers and Memory

  1. PointersUnderstand memory addresses and variables that store them.
  2. Pointers and ArraysSee how arrays and pointers are related, and use pointer arithmetic.
  3. Advanced PointersPointers to pointers, pointers and 2-D arrays, arrays of pointers, and function pointers.
  4. Dynamic MemoryAllocate memory at run time with malloc and release it with free.

6Structures and Files

  1. StructuresGroup related values into one custom type with struct.
  2. Unions, Enums and typedefShare memory between members with unions, name constants with enums, and understand struct sizes and padding.
  3. File HandlingWrite data to files and read it back with fopen, fprintf and fgets.

7Preprocessor and Practice

  1. The Preprocessor and Macros#include, #define, macro pitfalls, conditional compilation and predefined macros.
  2. C GATE Practice SetMixed GATE-style questions on C programming. Predict the output of each program, then check your answer.