Skip to Main Content
University of Kerala • BCA Semester 1 • UK1DSCCAP101

Problem Solving using C Notes

DSC course under University of Kerala (UoK FYUGP Regulations). Credits: 4 | 60 Hours (4 Hrs/Week).

Curated by Anoop (Thiruvananthapuram) (BCA Academic Contributor)•Last updated: November 2026•Based on University of Kerala FYUGP Regulations

Chapter-Wise Module Notes & PDF Downloads

Short Notes

All Modules Included

Complete syllabus revision notes covering all modules in one single PDF

Module 1

Introduction to Programming

Module 2

Basic Concepts

Module 3

Functions & Pointers

Module 4

Structures and Files

Module 5

Preprocessor, Headers, CLI Arguments & Advanced Programs

Interactive Reading Experience

Read Module Notes Online

Module I: Introduction to Programming

Algorithms, Flowcharts, C Compilation Pipeline, Tokens, Data Types & Storage Classes

Chapter 1: Problem Solving, Algorithms, and Flowcharts

1.1 Computational Problem Solving Lifecycle

Computer programming is not merely the mechanical act of typing syntax into an editor; it is the disciplined engineering process of translating an ambiguous real-world requirement into an unambiguous sequence of machine-executable instructions. Before writing a single line of C code, a programmer systematically decomposes the task using the Input–Process–Output (IPO) model. First, the programmer identifies all valid inputs, their domains, and edge cases. Second, the programmer formulates the deterministic transformation steps required to convert inputs into desired outputs. Third, the programmer verifies correctness across boundary values (such as zero, negative numbers, or empty collections) before implementing and testing the program in C.

During the design stage, two complementary representations bridge human reasoning and source code: algorithms (textual, step-by-step finite specifications written in structured prose or pseudocode) and flowcharts (standardized geometric diagrams depicting control flow and branching). Pseudocode strips away compiler-specific punctuation while retaining control structures such as IF-THEN-ELSE and WHILE, allowing teams to verify logic independently of any programming language.

1.2 Characteristics of an Algorithm and Complexity Intuition

Formalized in computer science by Donald Knuth, an algorithm is a finite, unambiguous, step-by-step procedure for solving a well-defined computational problem. Every valid algorithm must satisfy five non-negotiable properties:

  • Finiteness: An algorithm must always terminate after executing a finite number of steps for every valid input. A procedure that enters an endless loop for valid data is not an algorithm.
  • Definiteness (Unambiguity): Each step must be precisely specified with exact mathematical or logical operations, leaving zero room for subjective interpretation.
  • Input: An algorithm accepts zero or more well-defined inputs supplied externally before or during execution.
  • Output: An algorithm must produce at least one observable output quantity having a specified relation to the inputs.
  • Effectiveness: Every elementary step must be sufficiently basic that it can, in principle, be carried out accurately in finite time using pencil and paper or basic processor instructions.

When multiple valid algorithms solve the same problem, we evaluate them by time complexity (how execution steps grow with input size) and space complexity (how auxiliary memory grows with input size). Suppose an algorithm checks whether a number is prime by testing divisors up to the value itself versus testing divisors only up to its square root. The step counts scale differently as the input magnitude grows:

Where: T(n) = total elementary division operations as a function of candidate integer n; c1, c2 = constant operations per loop iteration; c0 = constant setup overhead. For n = 1,000,000, the square-root bound performs roughly 1,000 checks instead of 1,000,000 checks.

1.3 Flowcharts and ANSI/ISO Standard Symbols

A flowchart provides a visual blueprint of program logic using standardized ANSI/ISO geometric shapes joined by directional flowlines. Flowcharts reveal unreachable branches, missing loop exits, and nested decision paths immediately at a glance.

Symbol Name Geometric Shape Semantic Role in Program Design Typical C Construct Mapped
Terminal Rounded oval / stadium Marks entry (START) and exit (STOP / RETURN) points of an algorithm or subprogram. int main(void) { ... return 0; }
Input / Output Parallelogram Represents reading external data from keyboard/files or displaying computed results. scanf(...), printf(...)
Process Rectangle Denotes internal computation, variable initialization, arithmetic assignment, or memory updates. sum = a + b; count++;
Decision Diamond Tests a Boolean condition with one incoming line and two or more labeled outgoing branches (True/False). if (...), while (...), for (...)
Flowline Solid line with arrowhead Indicates exact chronological direction of control transfer between adjacent symbols. Sequential execution / loop back-edge
On-Page Connector Small circle with label Joins distant points within the same page cleanly without crossing flowlines. Structured block continuation
Off-Page Connector Home-plate pentagon Links a control path exiting one printed page to an identically labeled entry on another page. Multi-page module flow
Predefined Process Double-lined rectangle Invokes an external subroutine or library procedure whose detailed logic is drawn separately. sqrt(d), user-defined function call

When constructing flowcharts, draw flow consistently top-to-bottom and left-to-right, ensure every diamond clearly labels all outgoing paths (Yes/No or True/False), avoid intersecting flowlines by employing connector circles, and guarantee that every path reaches a valid terminal STOP. While flowcharts excel for pedagogical clarity and small-to-medium control flows, they become cumbersome to redraw when complex multi-module programs undergo frequent refactoring—making modular C code and concise pseudocode preferable in large-scale systems.

1.4 Worked Algorithmic Walkthroughs

Algorithm 1.1: Roots of a Quadratic Equation. Consider finding the real or complex roots of a quadratic equation where the leading coefficient is non-zero:

Where: a, b, c = real coefficients entered by the user; Δ = discriminant governing root nature; x = root(s) of the equation. If Δ > 0, two distinct real roots exist; if Δ = 0, one repeated real root -b / (2a) exists; if Δ < 0, complex conjugate roots (-b / 2a) ± i(√(-Δ) / 2a) exist.
  1. Step 1 (Start & Input): Read real values a, b, and c.
  2. Step 2 (Validate Domain): If a == 0, report that the equation is linear rather than quadratic and terminate.
  3. Step 3 (Compute Discriminant): Set d = b * b - 4 * a * c.
  4. Step 4 (Branch on Discriminant):
    • If d > 0, compute r1 = (-b + sqrt(d)) / (2 * a) and r2 = (-b - sqrt(d)) / (2 * a), then print both real roots.
    • Else if d == 0, compute r1 = -b / (2 * a) and print repeated real root.
    • Else (d < 0), compute real = -b / (2 * a) and imag = sqrt(-d) / (2 * a), then print real + i*imag and real - i*imag.
  5. Step 5 (Stop): Terminate algorithm cleanly.

Worked Numerical Trace: Suppose a = 1, b = -5, c = 6. Then d = (-5)*(-5) - 4*1*6 = 25 - 24 = 1 > 0. Branch 1 executes: r1 = (5 + 1)/2 = 3.0 and r2 = (5 - 1)/2 = 2.0. Now suppose a = 1, b = 2, c = 5: then d = 4 - 20 = -16 < 0, triggering Branch 3 with real = -1.0 and imag = 4 / 2 = 2.0, yielding roots -1 + 2i and -1 - 2i.

Algorithm 1.2: Greatest Common Divisor (Euclidean Algorithm). Given two positive integers m and n, repeatedly replace (m, n) with (n, m mod n) until n becomes 0; the remaining m is the GCD. Tracing m = 48, n = 18: iteration 1 sets m = 18, n = 48 % 18 = 12; iteration 2 sets m = 12, n = 18 % 12 = 6; iteration 3 sets m = 6, n = 12 % 6 = 0; loop exits and outputs 6.

Chapter 2: Structure of a C Program and Compilation Architecture

2.1 Anatomy of a Standard C Program

Developed by Dennis Ritchie at Bell Laboratories in 1972 to re-implement the UNIX operating system, C is a general-purpose, procedural, middle-level structured programming language. Every well-organized C source file follows a clear six-part layout:

  • Documentation Section: Multi-line (/* ... */) or single-line (// ...) comments describing program purpose, author, inputs, and outputs. Comments are stripped completely by the compiler preprocessor and generate zero machine instructions.
  • Link Section: Preprocessor directives such as #include <stdio.h> that instruct the compiler to embed library declarations (function prototypes, types, and standard constants) prior to compilation.
  • Definition Section: Symbolic constant and macro definitions using #define (for example, #define PI 3.14159).
  • Global Declaration Section: Variables and user-defined function prototypes declared outside all functions so they remain visible across multiple functions in the translation unit.
  • main() Function Section: Mandatory execution entry point invoked by the C runtime startup stub. Every C executable contains exactly one main() function partitioned into local variable declarations and executable statements inside braces { ... }, ending with return 0; to notify the operating system of normal completion.
  • Subprogram Section: Definitions of user-defined helper functions called directly or indirectly from main().
Listing 1.1: Canonical Six-Section Structure of a C Program
/* Documentation Section: Computes area and circumference of a circle */
#include <stdio.h>              /* Link Section: Standard I/O header */

#define PI 3.14159265           /* Definition Section: Symbolic constant */

double circle_area(double r);   /* Global Declaration: Function prototype */
int call_count = 0;             /* Global variable initialized to 0 */

int main(void) {                /* Entry point of execution */
    double radius = 0.0;        /* Declaration part */
    double area = 0.0;
    double circumference = 0.0;

    printf("Enter circle radius: ");
    if (scanf("%lf", &radius) != 1 || radius < 0.0) {
        printf("Invalid non-negative radius required.\n");
        return 1;               /* Non-zero status indicates input error */
    }

    area = circle_area(radius); /* Executable statements */
    circumference = 2.0 * PI * radius;

    printf("Radius        = %.2f\n", radius);
    printf("Area          = %.4f\n", area);
    printf("Circumference = %.4f\n", circumference);
    printf("Helper calls  = %d\n", call_count);
    return 0;                   /* Normal termination status */
}

double circle_area(double r) {  /* Subprogram Section */
    call_count++;
    return PI * r * r;
}

2.2 The Header File Concept and Standard Library Interfaces

A header file (extension .h) acts as an interface contract between compiled library implementations and client C source files. The core C language itself contains zero built-in keywords for keyboard input, screen output, string copying, or trigonometry; instead, those capabilities reside in precompiled standard libraries. When you write #include <stdio.h>, the preprocessor literally pastes the contents of stdio.h into your source file before syntax checking begins, supplying the exact parameter types and return types of printf() and scanf() so the compiler verifies type safety at every call site.

  • Angle Brackets #include <header.h>: Directs the preprocessor to search standard system include directories configured by the compiler toolchain. Used for standard C headers (stdio.h, stdlib.h, math.h, string.h, ctype.h, limits.h, float.h, time.h).
  • Double Quotes #include "myheader.h": Searches the current directory of the source file first, falling back to system directories only if not found locally. Used for programmer-authored module headers.

2.3 File Extensions Across the C Build Ecosystem

Working effectively with C toolchains such as GCC, Clang, or MSVC requires recognizing the intermediate artifacts created while transforming human-readable source text into native binary machine code.

Extension File Category Readable Format? Stage Produced & Purpose
.c C Source Code Yes (Plain Text) Authored by the programmer; contains preprocessor directives, declarations, and C function definitions.
.h Header File Yes (Plain Text) Stores function prototypes, #define macros, struct/typedef definitions, and extern contracts.
.i Preprocessed Source Yes (Expanded C) Produced after preprocessing (gcc -E); comments stripped, headers pasted, and macros expanded.
.s / .asm Assembly Source Yes (Mnemonics) Produced by the compiler backend (gcc -S); target-CPU instructions (x86-64 or ARM mnemonics).
.o / .obj Object Code No (Binary) Produced by the assembler (gcc -c); relocatable machine code with unresolved external symbol tables.
.a / .lib Static Library Archive No (Binary) Bundled collection of object files linked directly into executables during static linking.
.so / .dll Shared / Dynamic Library No (Binary) Dynamically loaded at program startup or runtime, saving disk space and memory across multiple processes.
.exe / a.out Executable Binary No (Binary) Produced by the linker; complete OS-loadable image (PE format on Windows, ELF on Linux) ready to run.

2.4 Compilation, Linking, and Execution Pipeline

Converting a .c file into a running process proceeds through four sequential toolchain phases followed by operating system loading:

  1. Preprocessing: Handles lines starting with #. Removes comments, expands #include headers recursively, substitutes #define macros, and evaluates conditional compilation guards (#ifdef/#endif).
  2. Compilation: Translates expanded C code through lexical analysis (tokenizing), syntax parsing (building an abstract syntax tree), semantic type checking, intermediate optimization, and code generation into target assembly instructions.
  3. Assembly: Converts human-readable assembly mnemonics into binary machine opcodes stored inside an object file (.o or .obj). Internal addresses are still relative rather than final memory locations.
  4. Linking: The linker merges all project object files with referenced standard libraries (such as libc or libm), resolves every external symbol reference (linking your call to printf with the binary implementation in the C standard library), assigns final virtual address layout, and writes the executable file.
  5. Loading and Execution: When you invoke the executable from a shell or IDE, the OS loader reads the binary header, maps code and data segments into RAM, initializes the runtime stack and heap, passes command-line arguments to the C startup routine (_start), and transfers control to main().

Understanding these stages clarifies why errors fall into four distinct categories: Syntax errors (missing semicolons, mismatched braces detected during compilation), Semantic errors (type mismatches or calling undeclared functions detected during compilation), Linker errors (misspelled function names, missing library flags like -lm, or absent main() detected during linking), and Runtime/Logical errors (division by zero, segmentation faults, or incorrect formulas emerging only after the binary executes).

Chapter 3: C Tokens, Identifiers, Variables, and Constants

3.1 C Character Set and Lexical Tokens

The C compiler breaks source text into atomic lexical units called tokens built from the C source character set: uppercase letters (A–Z), lowercase letters (a–z), decimal digits (0–9), special punctuation symbols (+ - * / % = < > & | ^ ~ ! ? : ; , . ( ) [ ] { } # " ' _), and whitespace characters (space, horizontal tab, newline, form feed). C classifies tokens into six categories:

  • Keywords: Thirty-two reserved words defined by ANSI C89/C90 (plus five added in C99 such as inline and restrict) having fixed compiler meaning: auto, break, case, char, const, continue, default, do, double, else, enum, extern, float, for, goto, if, int, long, register, return, short, signed, sizeof, static, struct, switch, typedef, union, unsigned, void, volatile, and while.
  • Identifiers: User-chosen names denoting variables, functions, array tags, structure tags, and typedef aliases.
  • Constants: Fixed literal values (numeric, character, enumeration) that cannot be altered during execution.
  • String Literals: Sequences of zero or more characters enclosed in double quotes ("Kerala"), automatically terminated by an invisible null character.
  • Operators: Symbols instructing the CPU to perform arithmetic, logical, relational, bitwise, or memory operations.
  • Punctuators / Separators: Structural delimiters including semicolons ;, commas ,, parentheses (), brackets [], and curly braces {}.

3.2 Rules for Naming Variables and Identifiers

An identifier is valid in C if and only if it obeys every lexical rule enforced by the standard:

  1. Permitted Characters: Only alphabetic letters (A–Z, a–z), digits (0–9), and the underscore character (_) may appear. Spaces, hyphens, currency symbols, and punctuation are strictly forbidden.
  2. Mandatory First Character: The very first character must be either an alphabetic letter or an underscore (_). Identifiers cannot begin with a digit.
  3. Case Sensitivity: C strictly distinguishes uppercase and lowercase letters; therefore, total, Total, and TOTAL represent three completely distinct identifiers.
  4. No Keyword Collisions: Reserved keywords (written in lowercase) cannot be reused as variable or function names.
  5. Significant Length and Reserved Underscores: ANSI C89 guarantees at least 31 significant characters for internal identifiers (63 in C99). Although leading underscores are syntactically allowed, identifiers starting with double underscores (__) or an underscore followed by an uppercase letter (_X) are reserved for the compiler and standard library and should be avoided in application code.
Candidate Identifier Validity Rule Explanation / Diagnostic
student_marks Valid Begins with a lowercase letter; contains only letters and underscore.
_buffer2 Valid Starts with underscore followed by letters and digit (though leading underscore is best reserved for system headers).
2ndValue Invalid Violates first-character rule: identifiers must not start with a digit.
gross-salary Invalid Contains hyphen (-), which the parser reads as subtraction operator between gross and salary.
total marks Invalid Embedded space separates the name into two adjacent tokens, triggering a syntax error.
float Invalid Collides with a reserved C keyword.
Float Valid (Poor Style) Permitted due to case sensitivity, but confusing and strongly discouraged.

3.3 Variables: Declaration, Definition, and Memory Semantics

A variable is a named storage location in primary memory capable of holding a data value of a declared type that can change during execution. Every variable has three fundamental attributes: its name (identifier), its type (determining bit width and encoding rules), and its address (physical/virtual byte location in RAM). A declaration introduces an identifier and its type to the compiler (as with extern int count;), whereas a definition additionally reserves storage bytes (as with int count;). Every local automatic variable defined without an initializer (e.g., int x; inside a function) contains an uninitialized garbage value leftover from previous stack usage; reading it prior to assignment produces unpredictable runtime results. Always initialize variables at definition (int x = 0;).

Variables also illustrate the distinction between an lvalue (locator value—an expression designating an identifiable memory location that can validly appear on the left side of =, such as score) and an rvalue (the transient data value read from memory or computed by an expression, which can appear only on the right side, such as a + 5).

3.4 Constants in C

Constants represent immutable values known at compile time or protected against modification during execution:

  • Integer Constants: Decimal literals use digits 0–9 without a leading zero (42, -19). Octal literals begin with a leading 0 using digits 0–7 (075 equals decimal 61). Hexadecimal literals begin with 0x or 0X using 0–9 and A–F (0x2F equals decimal 47). Suffixes U/u and L/l specify unsigned or long width (100000UL).
  • Floating-Point Constants: Written either in decimal form containing a decimal point (3.14159, -0.005) or in scientific/exponential notation (6.022e23, 1.6e-19). By default, floating literals have type double; appending f/F yields float, and l/L yields long double.
  • Character Constants and Escape Sequences: A single character enclosed in single quotes ('A', '7', '+') stores its numeric ASCII code (for instance, 'A' is 65, 'a' is 97, '0' is 48) as an integer value. Non-printable or syntactically special characters are represented using backslash escape sequences.
  • Symbolic Constants (#define vs const): Preprocessor macro constants (#define TAX_RATE 0.18) perform pure textual substitution before compilation and occupy zero variable storage, whereas typed const variables (const double TAX_RATE = 0.18;) obey C type checking, scope rules, and have an addressable memory location. Enumeration constants declared via enum assign sequential named integers starting from 0 unless overridden (enum Status { ERR = -1, OK = 0 };).
Escape Sequence ASCII Value Control Action / Character Represented
\n10Newline — moves cursor to beginning of next output line.
\t9Horizontal tab — advances cursor to next tab stop column.
\r13Carriage return — returns cursor to start of current line without advancing vertically.
\00Null character — marks the mandatory end of every C string.
\b8Backspace — moves cursor one column backward on supported terminals.
\a7Audible alert / terminal bell.
\\92Literal backslash character inside character or string literals.
\" and \'34 / 39Literal double quote or single quote character.

Chapter 4: Basic Data Types, Ranges, and Storage Classes

4.1 Fundamental Data Types and Type Modifiers

C is a statically typed language: every variable and expression possesses a compile-time data type specifying how many bytes it occupies and how bit patterns are decoded. The four primary scalar types plus the empty type void form the foundation:

  • char: Smallest addressable integer unit (1 byte = 8 bits), designed to hold a single ASCII character or tiny signed/unsigned integer.
  • int: Natural word-sized whole-number type used for counters, indices, flags, and discrete arithmetic.
  • float: Single-precision IEEE 754 binary floating-point number supporting fractional real numbers with roughly 6–7 significant decimal digits.
  • double: Double-precision IEEE 754 binary floating-point number providing roughly 15–16 significant decimal digits and wider exponent range; preferred for scientific calculation.
  • void: Incomplete type denoting absence of a value—used to declare functions returning nothing (void greet(void)), empty parameter lists, and generic untyped pointers (void *).

Four keyword modifiers—signed, unsigned, short, and long—adjust sign interpretation and bit width of integral types (and long double extends precision for floating values).

4.2 Storage Capacity, Binary Range Mathematics, and Comparison

The numeric limits of any integral type follow directly from binary two's complement representation over its allocated bit width:

Where: n = 8 × sizeof(type) denotes total bits allocated. Because two's complement reserves one bit pattern (all-zero MSB negative extreme) asymmetrically, the negative bound magnitude exceeds the positive bound by 1.

Worked Range Calculation: For an 8-bit signed char (n = 8), the range spans from to , whereas unsigned char spans from 0 to . For a 32-bit signed int (n = 32), the range spans from to . Exceeding the positive maximum on an unsigned integer wraps around modulo , whereas signed integer overflow produces unpredictable behavior and must be prevented via wider types such as long long or range validation.

Data Type Typical Size (Bytes) Exact Value Range (Standard 32/64-bit Toolchain) printf / scanf Specifier
char / signed char 1 (8 bits) -128 to +127 %c (char) or %hhd
unsigned char 1 (8 bits) 0 to 255 %c or %hhu
short int 2 (16 bits) -32,768 to +32,767 %hd
unsigned short int 2 (16 bits) 0 to 65,535 %hu
int (signed) 4 (32 bits) -2,147,483,648 to +2,147,483,647 %d or %i
unsigned int 4 (32 bits) 0 to 4,294,967,295 %u (%o oct, %x hex)
long long int 8 (64 bits) -9,223,372,036,854,775,808 to +9,223,372,036,854,775,807 %lld
float 4 (32 bits) ±3.4 × 10-38 to ±3.4 × 10+38 (~6 decimal digits) %f, %e, %g
double 8 (64 bits) ±1.7 × 10-308 to ±1.7 × 10+308 (~15 decimal digits) %lf (in scanf), %f/%lf
long double 12 or 16 Up to ±1.1 × 10+4932 (~19 digits on x87 80-bit) %Lf

Note that in legacy 16-bit MS-DOS compilers (such as Turbo C), int occupied 2 bytes (-32,768 to +32,767), whereas modern 32-bit and 64-bit compilers (GCC, Clang, MSVC) allocate 4 bytes for int. Always use the compile-time sizeof(type) operator and constants inside <limits.h> (INT_MIN, INT_MAX) and <float.h> (FLT_DIG, DBL_MAX) rather than hardcoding sizes.

Listing 1.2: Lab Part A — Demonstrating Basic Data Types, sizeof, and Limits
#include <stdio.h>
#include <limits.h>
#include <float.h>

int main(void) {
    char grade = 'A';
    int students = 120;
    unsigned int port = 8080U;
    long long population = 1428627663LL;
    float cgpa = 8.75f;
    double pi_precise = 3.141592653589793;

    printf("char   grade      = %c (ASCII %d), size = %zu byte\n",
           grade, grade, sizeof(char));
    printf("int    students   = %d, size = %zu bytes, range = [%d, %d]\n",
           students, sizeof(int), INT_MIN, INT_MAX);
    printf("uint   port       = %u, size = %zu bytes, max = %u\n",
           port, sizeof(unsigned int), UINT_MAX);
    printf("llong  population = %lld, size = %zu bytes\n",
           population, sizeof(long long));
    printf("float  cgpa       = %.2f, size = %zu bytes, digits = %d\n",
           cgpa, sizeof(float), FLT_DIG);
    printf("double pi         = %.15f, size = %zu bytes, digits = %d\n",
           pi_precise, sizeof(double), DBL_DIG);
    return 0;
}

4.3 Storage Classes in C

Beyond data type, every C variable possesses a storage class specifier defining four behavioral attributes: (1) where the variable is physically stored (RAM stack, CPU register, or static data segment), (2) its default initial value if uninitialized, (3) its lexical scope (regions where its name is visible), and (4) its runtime lifetime (duration across which its memory remains reserved).

  • auto (Automatic): Default storage class for all local variables declared inside blocks or functions. Allocated on the call stack upon block entry and destroyed immediately upon block exit. Holds an uninitialized garbage value unless explicitly initialized. The keyword auto is almost always omitted in practice.
  • register: Advises the compiler to store a frequently accessed local variable (such as a tight loop index) in a high-speed CPU register rather than RAM. Its scope, lifetime, and default garbage value match auto. Crucially, because CPU registers have no RAM byte address, applying the address-of operator & to a register variable triggers a compile-time error in C.
  • static: Exhibits two distinct roles depending on placement. When applied to a local variable inside a function, static moves storage from the transient stack to the persistent Data/BSS segment: it is initialized strictly once (defaulting to 0) before program logic starts and retains its last modified value across repeated calls to that function, though its visibility stays strictly local to the block. When applied to a global variable or function outside all blocks, static assigns internal linkage, restricting visibility exclusively to the current .c source file and preventing name clashes across multi-file projects.
  • extern (External): Declares a global variable or function whose physical storage is defined elsewhere (usually earlier in the same file or inside another linked .c file). It tells the compiler the variable's type without allocating redundant bytes. All global variables have static lifetime and default to 0.
Storage Class Memory Segment Default Initial Value Lexical Scope Runtime Lifetime
auto Call Stack (RAM) Uninitialized garbage Local to enclosing block Until enclosing block exits
register CPU Register (or Stack) Uninitialized garbage Local to enclosing block Until enclosing block exits
static (local) Data / BSS Segment 0 (or 0.0 / NULL) Local to enclosing block Entire program execution
static (global) Data / BSS Segment 0 Current .c file only Entire program execution
extern Data / BSS Segment 0 (at defining site) Global across linked files Entire program execution
Listing 1.3: Demonstrating Persistence and Scope Across auto, static, register, and extern
#include <stdio.h>

extern int shared_limit;        /* Declaration referencing global definition below */

void track_calls(void) {
    auto int local_auto = 1;    /* Re-initialized to 1 on every call */
    static int persist = 0;     /* Initialized once to 0; preserved across calls */

    local_auto++;
    persist += 10;
    printf("local_auto = %d | static persist = %d | shared_limit = %d\n",
           local_auto, persist, shared_limit);
}

int main(void) {
    register int i;             /* Hint to hold loop counter in CPU register */
    for (i = 0; i < 3; i++) {
        track_calls();
    }
    return 0;
}

int shared_limit = 500;         /* Actual global definition */

University of Kerala FYUGP Academic Framework

Course CodeUK1DSCCAP101
Credits4 Credits (60h)
Internal (CIE)30 Marks
End-Sem (ESE)70 Marks

Syllabus details for BCA Semester 1 under official University of Kerala regulations.

Assessment comprises a 70-mark End-Semester Examination (2.5 Hours) and 30-mark Continuous Internal Evaluation.

About Problem Solving using C (University of Kerala BCA Sem 1)

Problem Solving using C (UK1DSCCAP101 • 4 Credits • 60 Hours (4 Hrs/Week)) is a DSC offering under the Bachelor of Computer Applications (BCA) Four-Year Undergraduate Programme (UoK FYUGP Regulations 2024 / 2025) at the University of Kerala. Structured across five sequentially integrated instructional modules, the course builds solid theoretical foundations and hands-on technical proficiency in problem solving using c. Students engage with core computing principles, structured problem-solving, implementation techniques, and modern industry practices aligned with Kerala State Higher Education Council outcome-based education standards.

Problem Solving using C Module-by-Module Curriculum Breakdown

Official syllabus unit modules prescribed by the University of Kerala FYUGP framework:

Module I

Introduction to Programming

Computer programming is not merely the mechanical act of typing syntax into an editor; it is the disciplined engineering process of translating an ambiguous real-world requirement into an unambiguous sequence of machine-executable instructions. Before writing a single line of C code, a programmer systematically decomposes the task using the Input–Process–Output (IPO) model. First, the programmer identifies all valid inputs, their domains, and edge cases.

Module II

Basic Concepts

An operator is a lexical symbol specifying an operation to be applied to one (unary), two (binary), or three (ternary) operands, while an expression combines operators, variables, and constants to yield a computed value. The foundational state-mutating operator in C is the simple assignment operator ( = ), which evaluates the rvalue expression on its right-hand side and stores the resulting value into the addressable lvalue variable on its left-hand side.

Module III

Functions & Pointers

Large software systems become unmanageable if written as a single monolithic main() function spanning hundreds of lines. Modular programming decomposes a complex task into compact, single-responsibility subprograms called functions using top-down refinement.

Module IV

Structures and Files

Whereas an array binds multiple items sharing the identical data type under a single name, real-world records typically bundle heterogeneous attributes of varying types—for example, representing a student by an integer roll number, a character array name, a single-character division code, and a floating-point CGPA. Keeping separate parallel arrays ( rolls[60], names[60][40], cgpas[60] ) quickly becomes error-prone when sorting or deleting entries.

Module V

Preprocessor, Headers, CLI Arguments & Advanced Programs

Before the C compiler ever parses a single variable declaration, loop, or semicolon, every source file passes through a specialized textual macro processor called the C Preprocessor (CPP). Operating strictly on lexical tokens and lines prior to syntax checking, the preprocessor strips comments, substitutes macros, merges header files, and selectively keeps or omits source code blocks.

Core Curriculum & Key Topics

  • Problem Solving, Algorithms, and Flowcharts
  • 1 Computational Problem Solving Lifecycle
  • 2 Characteristics of an Algorithm and Complexity Intuition
  • 3 Flowcharts and ANSI/ISO Standard Symbols
  • 4 Worked Algorithmic Walkthroughs
  • Structure of a C Program and Compilation Architecture
  • 1 Anatomy of a Standard C Program
  • 2 The Header File Concept and Standard Library Interfaces

Learning Outcomes

  • Demonstrate authoritative comprehension of the foundational concepts, architectures, and principles of problem solving using c.
  • Apply algorithmic, programming, or analytical techniques to design and evaluate practical computing solutions.
  • Analyze system trade-offs, security considerations, and industry standards relevant to modern software and IT environments.
  • Implement, test, and document structured technical workflows aligned with professional computing practices.
  • Achieve exam-ready mastery of University of Kerala FYUGP BCA question patterns across short concepts, technical comparisons, and comprehensive essays.

University of Kerala Examination Scheme for Problem Solving using C

The evaluation framework for Problem Solving using C (UK1DSCCAP101) under University of Kerala FYUGP regulations combines Continuous Internal Evaluation (30 Marks) with the university End-Semester Examination (70 Marks) for a total of 100 Marks (2.5 Hours duration):

Part A: Conceptual Questions

10 Questions × 3 Marks (Maximum ceiling 24 Marks). Short definitional and conceptual questions covering all 5 syllabus modules.

Part B: Analytical Problems

8 Questions × 6 Marks (Maximum ceiling 36 Marks). Paragraph questions, comparative evaluations, and analytical problems.

Part C: Comprehensive Essays

2 Questions × 10 Marks (Answer any 1 for 10 Marks). Long-form essay or comprehensive numerical workout problem.

Exam Preparation Strategy:

To score top marks in the University of Kerala UK1DSCCAP101 (Problem Solving using C) examination: 1. Write Clean, Traceable Code Snippets: Always include well-indented syntax examples with sample input and expected output for programming questions. 2. Explain Logic & Control Flow Step-by-Step: Before writing full programs, briefly outline the algorithm, key functions, or class hierarchy so examiners can award full step marks. 3. Highlight Edge Cases & Syntax Rules: Mention common runtime pitfalls, data type constraints, or security/validation practices where relevant. 4. Manage Time Across Sections: For the 2.5-hour 70-mark external paper, allocate 25 minutes to Part A definitions, 50 minutes to Part B short programs and comparisons, and 75 minutes to Part C full code-backed essays.

Exam Preparation & Study Guides — Problem Solving using C

What is Problem Solving, Algorithms, and Computational Decomposition and why is it important in Problem Solving using C?

Programming transforms an operational specification into deterministic machine instructions through the Input-Process-Output (IPO) model, breaking complex logic into unambiguous pseudocode and algorithmic procedures verified on boundary cases prior to coding.

What is Preprocessed (.i) &rarr; Assembly (.s /.asm) and why is it important in Problem Solving using C?

The compiler performs lexical scanning, syntax parsing, semantic type checks, optimization, and emits CPU assembly mnemonics.

What is Worked Expression Trace and why is it important in Problem Solving using C?

With int a=10, b=3, c=2, d=5, evaluating a + b * c &minus; d / 2 % 2 > 12 &&!0 computes!0=1, b*c=6, d/2=2, 2%2=0, 10+6&minus;0=16, 16>12=1, and 1&&1=1.

What is Scope, Lifetime, and Passing Arrays and why is it important in Problem Solving using C?

Local variables live inside call-stack frames pushed on call and popped on return; global variables live in Data/BSS across execution. Passing an array decays automatically to &arr[0] in O(1) time without copying, so pass length n explicitly (and use const int a[] when read-only); 2D array parameters require explicit column width (int m[][10]).

What is the key distinction in Structure vs Union Comparison?

Structures allocate disjoint offsets and retain all members simultaneously (total size &ge; sum); Unions overlay all members at offset 0 and hold one active member (size = largest member).

What is the official course code and credit structure for Problem Solving using C at University of Kerala?

Problem Solving using C carries the official course code UK1DSCCAP101 under the University of Kerala FYUGP BCA framework. It is awarded 4 credits (60 Hours (4 Hrs/Week)), evaluated through 30 marks Continuous Internal Evaluation (CIE) and 70 marks End-Semester Examination (ESE).

Where can students download free PDF notes for Problem Solving using C?

Students can read all 5 module notes online and download verified chapter-wise PDFs, combined exam notes, and quick revision sheets for Problem Solving using C (UK1DSCCAP101) directly from DegreeLive (degreelive.in) with zero paywalls or sign-ups.

Academic Standards

Course outlines and study notes follow official University of Kerala curricula. Curated by Anoop (Thiruvananthapuram).

For feedback or corrections, contact [email protected].

Related Study Resources & Student Support

Related Semester 1 Subjects

Browse study notes for other courses in BCA Sem 1:

Degree Scholarships

Financial Aid & Grants 2026-27

Check eligibility criteria and deadlines for Kerala government and merit scholarships (e-Grantz 3.0, KSHEC, DCE).

Explore All Scholarships

Request Notes

Can't find what you're looking for? Let us know which subject notes you need.

Submit Request