Programming

C Programming for C-CAT: Concepts and Safe Output Tracing

C Programming in the official Section B syllabus

Free Learning preparation advice: The detailed examples and study order below are editorial suggestions, not an official subtopic list or prediction of question frequency. The official indicative syllabus does not assign subject-wise question counts or difficulty percentages.

C Programming is an official Section B subject. No verified fixed C question count or score-to-rank benefit is available. Practice understanding the language rather than memorising “10–12 questions” predictions.

State a language standard when tracing code. C passes arguments by value; a pointer parameter can let a function modify the caller's object. If behaviour is undefined or implementation-defined, do not invent a universal output. C-CAT uses objective questions, not a live code-submission task.

Pointers — an editorial study focus

Use this pointer checklist to guide practice:

Key Concepts to Master

  • Pointer basics: Declaration, initialization, dereferencing
  • Pointer arithmetic: Incrementing/decrementing pointers, pointer subtraction, effect of data type on arithmetic
  • Void pointer: Generic pointer that can point to any data type, needs casting before dereferencing
  • NULL pointer: Points to nothing, used for error checking
  • Function pointers: Pointers that store the address of functions, used for callbacks
  • Pointer to pointer: Double pointers and their applications
  • Array-pointer relationship: Array-to-pointer conversion and its exceptions, array of pointers vs pointer to array

Common Question Types

  • Output prediction with pointer arithmetic
  • Size of pointer vs size of array
  • Pointer and string manipulation
  • Dynamic memory allocation (malloc, calloc, realloc, free)

Arrays & Strings

Arrays

  • 1D Arrays: Declaration, initialization, accessing elements, passing to functions
  • 2D Arrays: C row-major storage, indexing and matrix operations
  • Array size: Using sizeof on an actual array object, not a pointer parameter
  • Dynamic arrays: malloc/calloc for runtime allocation

Strings

  • String declaration: Character array vs string literal, null terminator
  • String functions: strlen, strcpy, strcat, strcmp — know their return types and behavior
  • String size vs length: Difference between sizeof and strlen
  • String manipulation: Reversing, palindrome check, character counting

Functions & Storage Classes

Functions

  • Pass by value and pointer parameters: Key difference and output prediction
  • Recursion: Factorial, Fibonacci, Tower of Hanoi — understand call stack behavior
  • Return types: Returning pointers, returning structures

Storage Classes

Storage ClassScopeLifetimeDefault Value
autoLocalFunction blockIndeterminate if uninitialised
registerLocalFunction blockIndeterminate if uninitialised
staticLocalEntire program0
externDeclaration-dependentStatic storage duration0 at an uninitialised definition; declaration alone allocates no object
Revision example: Static variables in recursive functions are useful tracing exercises. Understand how static retains its value across function calls.

Structures, Unions & Enums

  • Structure: Member access (dot and arrow operators), structure padding, sizeof struct
  • Union: Difference from structure — union uses shared memory, size is at least the largest member, with possible alignment padding
  • Enum: Enumeration constants, default values starting from 0
  • Typedef: Creating type aliases for cleaner code
  • Bit fields: Compact structure members with specified bit width

Preprocessor, Macros & File Handling

Preprocessor & Macros

  • #define macros — text substitution, side effects with increment operators
  • #include — header files
  • Conditional compilation (#ifdef, #ifndef)
  • Macro vs function — key differences

File Handling

  • File modes (r, w, a, r+, w+, a+)
  • fopen, fclose, fprintf, fscanf
  • fgets, fputs, fread, fwrite

Command Line Arguments

Know how argc and argv work — argc is the count of arguments, argv is an array of string pointers.

Practice strategy

Read a concept, trace a small defined example, then compile and test it locally with suitable warnings. Explain errors and edge cases. Use the data-structures guide to connect pointer-based structures with their operations. Our resource suggestions are not a claim of official endorsement.

Use the verified pattern and syllabus guide to check coverage and the mock-test page for timed practice. The free Quick Test is separate from paid full mocks. Subject-wise notes and chapter practice and previous year question papers are paid products with 90-day access. Free Learning questions are not official C-DAC papers.