Foundation & BasicBeginner

C & C++ Foundation

Programming logic, C fundamentals, functions, arrays and pointers; C++ OOP, file basics, debugging and a mini-project.

Talk to a counsellor about C & C++ Foundation

Fees, batch dates and timings are shared by a counsellor. No payment is needed to ask.

What you will cover
  • Programming logic
  • C fundamentals
  • functions
  • arrays
  • pointers; C++ OOP
  • file basics
  • debugging
  • a mini-project

Topic list from the institute's programme record.

Certification

Certificate terms for this programme are confirmed by the institute at admission. Any ADIVAS course-completion certificate is an institute certificate; it is not a university degree, an externally accredited qualification or a vendor certification (such as AWS or Microsoft) unless the institute states so in writing.

Curriculum 0.1 · Draft: written for ADIVAS and awaiting academic review and approval. Topics and weeks may change before your batch starts.

Your skill trail

You move through 5 stations. Each week builds one skill you can show, not just a topic you have heard.

  1. Logic and first programs

    Turn a problem into an algorithm and write simple C programs with input and output.

    • Week 1 Think like a programmer
    • Week 2 C basics: data, input and output
  2. Control flow

    Use decisions and loops confidently and verify them with trace tables and test cases.

    • Week 3 Making decisions
    • Week 4 Loops and tracing
  3. Functions, arrays and pointers

    Structure programs with functions and arrays, and understand pointers and memory.

    • Week 5 Functions
    • Week 6 Arrays and strings
    • Week 7 Pointers
  4. Records, files and C++ objects

    Store data in structs and files, and model the same data with a C++ class.

    • Week 8 Structures and file basics
    • Week 9 From C to C++: classes and objects
  5. Debugging and mini-project

    Find and fix bugs systematically and present a tested mini-project.

    • Week 10 Debugging and mini-project demo
  6. Student Marks Manager (C with a C++ class version)

    Your project, reviewed by a trainer.

The ADIVAS mastery ladder: how each skill is recognised
  1. Explored You have seen the idea and tried a first example.
  2. Practising You can do it with hints and keep improving.
  3. Proficient You complete the weekly practical task correctly on your own.
  4. Proven You apply it in a project reviewed by your trainer.

Skill-level tracking is being added to the learner workspace. Your trainer already reviews weekly practical work.

What you will be able to do

  • Express a solution as an algorithm or flowchart and trace it by hand.
  • Write C programs using variables, input/output, operators, decisions and loops.
  • Structure programs with functions, arrays and strings.
  • Use pointers correctly and explain addresses and values with a memory diagram.
  • Store records in structs and read and write text files safely.
  • Create simple C++ classes using encapsulation and a basic inheritance example.
  • Debug with compiler warnings, tracing and test tables, and deliver a tested mini-project.

Who it suits

  • School Students in Classes 9-12 who enjoy logic puzzles and are ready to learn their first programming language.
  • College College students (BCA, BSc, BE and diploma) who need a solid programming base for later subjects.
  • Professional Working adults and career changers who want to learn programming fundamentals from scratch.

Prerequisites: Comfortable use of a computer; basic school mathematics. No prior programming needed. Tools: GCC or Clang compiler (MinGW-w64 on Windows), Visual Studio Code or Code::Blocks, GDB debugger, Valgrind or AddressSanitizer (Linux, or WSL on Windows), Git.

Weekly plan

Logic and first programs Weeks 1–2

Week 1: Think like a programmer

Theory
  • Problems, algorithms and flowcharts
  • Sequence, decision and repetition
  • Installing GCC and VS Code; compile and run
Lab
Install a C compiler and editor, compile and run Hello World, then draw a flowchart and numbered steps for finding the largest of three marks.
Homework
Write an algorithm for withdrawing cash from an ATM and trace it with two example inputs.
Deliverable
A flowchart and a compiling Hello program saved in a Week-1 folder.
Weekly checkpoint
Order the steps of an algorithm; trace a small flowchart.
You will be able to
Express a solution as an algorithm or flowchart and trace it by hand.

Week 2: C basics: data, input and output

Theory
  • Variables and the types int, float, char
  • printf and scanf format specifiers
  • Arithmetic operators and integer division
Lab
Write a program that reads quantity and unit price in ₹ and prints the bill with 18% GST, then explain why 7/2 gives 3.
Homework
Write a temperature converter and a simple-interest calculator.
Deliverable
bill.c with sample runs pasted as comments.
Weekly checkpoint
Predict outputs of five short snippets involving int and float.
You will be able to
Write C programs using variables, input/output, operators, decisions and loops.
Control flow Weeks 3–4

Week 3: Making decisions

Theory
  • if, else-if ladders and nested conditions
  • Relational and logical operators; = versus ==
  • switch and menu-driven programs
Lab
Build a grade calculator and a leap-year checker. Before coding, write a table of test inputs including boundary values.
Homework
Write a menu program (1 Add, 2 Subtract, 3 Multiply, 4 Divide) that refuses division by zero.
Deliverable
Two programs plus a written test table.
Weekly checkpoint
Debug an if statement that uses = by mistake; choose good test inputs.
You will be able to
Write C programs using variables, input/output, operators, decisions and loops.

Week 4: Loops and tracing

Theory
  • for, while and do-while
  • break and continue
  • Nested loops and patterns
  • Trace tables
Lab
Print a multiplication table, the sum of digits of a number and a triangle pattern; trace each loop on paper first.
Homework
Write a program that reads marks until the user enters -1 and prints the average.
Deliverable
A trace table and three loop programs.
Weekly checkpoint
Predict loop output and find one off-by-one bug.
You will be able to
Write C programs using variables, input/output, operators, decisions and loops.
Functions, arrays and pointers Weeks 5–7

Week 5: Functions

Theory
  • Declaration, definition and calling
  • Parameters, return values and scope
  • Pass by value
  • Recursion: factorial and Fibonacci
Lab
Refactor the bill program into functions (readInput, calcGst, printBill) and test each function with five inputs.
Homework
Write isPrime(n) and use it to list primes up to 100.
Deliverable
A modular program with one test table per function.
Weekly checkpoint
Predict output when a function changes its parameter; identify scope errors.
You will be able to
Structure programs with functions, arrays and strings.

Week 6: Arrays and strings

Theory
  • One- and two-dimensional arrays
  • Array bounds and common errors
  • Strings and the null terminator; string.h
  • Linear search and bubble sort
Lab
Read marks of 10 students, then print the average, highest, lowest and search for a given mark; reverse a string without using strrev.
Homework
Sort 8 numbers with bubble sort and show the array after each pass.
Deliverable
marks.c and a pass-by-pass sorting table.
Weekly checkpoint
Find an out-of-bounds bug; trace a bubble sort pass.
You will be able to
Structure programs with functions, arrays and strings.

Week 7: Pointers

Theory
  • Addresses and the & and * operators
  • Pointers and arrays
  • Passing pointers to functions (swap)
  • NULL and common pointer bugs
Lab
Write swap(), a function that doubles a value through a pointer and a loop that walks an array with a pointer; draw a memory picture.
Homework
Explain in your own words the difference between p and *p with two diagrams.
Deliverable
pointers.c and a hand-drawn memory diagram.
Weekly checkpoint
Match pointer expressions to meanings; predict output of a pointer snippet.
You will be able to
Use pointers correctly and explain addresses and values with a memory diagram.
Records, files and C++ objects Weeks 8–9

Week 8: Structures and file basics

Theory
  • struct and arrays of struct
  • Opening, reading, writing and closing text files
  • Checking fopen for NULL
  • Designing a record format
Lab
Create a Student struct, save five records to students.txt and load them back; test what happens when the file is missing.
Homework
Add search by roll number and plan the mini-project menu.
Deliverable
Working save/load code and the mini-project plan.
Weekly checkpoint
Find the missing NULL check; order the steps to save records.
You will be able to
Store records in structs and read and write text files safely.

Week 9: From C to C++: classes and objects

Theory
  • cin/cout, references and the C++ string and vector
  • Classes, objects and constructors
  • private/public and encapsulation
  • Introduction to inheritance
Lab
Convert the Student struct into a class with a validating constructor and a display() method; store students in a std::vector.
Homework
Add a Teacher class that shares a Person base class and explain what is reused.
Deliverable
student.cpp with a short design note.
Weekly checkpoint
Scenario questions on encapsulation; read a small class and predict its output.
You will be able to
Create simple C++ classes using encapsulation and a basic inheritance example.
Debugging and mini-project Weeks 10

Week 10: Debugging and mini-project demo

Theory
  • Reading compiler errors and warnings (-Wall)
  • Debugging with print statements and gdb basics
  • Writing test tables
  • Presenting and reviewing code
Lab
Fix five seeded bugs (missing return, off-by-one, uninitialised variable, wrong operator, missing NULL check) and then demo your Student Marks Manager.
Homework
Write a short reflection on the three bugs that cost you the most time.
Deliverable
Final mini-project with test table and reflection.
Weekly checkpoint
Debugging scenario questions and a live demo with questions from the trainer.
You will be able to
Debug with compiler warnings, tracing and test tables, and deliver a tested mini-project.

Sample lessons

Week 4

Loops and trace tables

A loop repeats a block of code while a condition is true. Before running a loop on the computer, you can run it on paper with a trace table: one row per repetition, one column per variable. Tracing is the fastest way to understand a loop and to find off-by-one mistakes, such as running one time too many or too few.

  1. 1Check the condition
  2. 2Run the loop body
  3. 3Update the variable
  4. 4Repeat or exit

Step by step

  1. Write the loop and list its variables: start value, condition, update.
  2. Draw a table with a column for each variable and for the output.
  3. Fill one row per repetition, updating the variables exactly as the code does.
  4. Stop when the condition becomes false and note the final values.
  5. Run the program and compare its output with your table.

In real life

A shop assistant adds the prices of 5 items on a bill one by one. A loop does the same: it repeats "add next price" until all 5 items are done.

Worked example

Problem. Trace: int sum = 0; for (int i = 1; i <= 4; i++) { sum = sum + i; } What is sum at the end?

Solution. i=1: sum=1; i=2: sum=3; i=3: sum=6; i=4: sum=10; then i=5 fails the condition i <= 4. Final sum is 10.

Common mistakes

  • Using <= when < is needed (or the reverse), giving one repetition too many or too few.
  • Forgetting to update the loop variable, which creates an infinite loop.
  • Changing the loop variable inside the body without meaning to.

Try it yourself

  • Trace for (int i = 10; i > 0; i -= 3) and list the values of i.
  • Write a loop that prints the table of 7 up to 10 times, then trace the first three rows.
  • Find the bug: for (int i = 1; i <= 5; i--) { printf("%d", i); }

Week 7

Pointers: addresses and values

Every variable lives at an address in memory. A pointer is a variable that stores such an address. The & operator gives the address of a variable and the * operator reads or writes the value at an address. Pointers let a function change the caller's variables and are the basis of arrays, strings and dynamic data structures in C.

  1. Variable x holds 5
  2. Address of x, for example 0x7ffe10
  3. Pointer p holds that address
  4. *p reads or writes x

Step by step

  1. Declare int x = 5; and print x and &x.
  2. Declare int *p = &x; and print p and *p.
  3. Change the value with *p = 9; and print x again.
  4. Write void swap(int *a, int *b) and call it as swap(&m, &n).
  5. Draw boxes for x and p with an arrow from p to x.

In real life

A courier needs a delivery address, not the house itself. A pointer is that address; following it (dereferencing) reaches the real house.

Worked example

Problem. int a = 4, b = 9; swap(&a, &b); What are a and b if swap exchanges the values through pointers?

Solution. swap receives the addresses of a and b and exchanges the values stored there, so a becomes 9 and b becomes 4.

Common mistakes

  • Using a pointer before it points to valid memory (uninitialised pointer).
  • Confusing p (the address) with *p (the value at the address).
  • Passing x instead of &x to a function that expects a pointer.

Try it yourself

  • Predict the output: int x = 3; int *p = &x; *p = *p + 2; printf("%d", x);
  • Write a function that doubles a number in place using a pointer.
  • Draw the memory picture for int arr[3] and a pointer to arr[1].

Try the questions

The same skills are asked at three levels: School (Classes 6–12), College and Professional. Switch the level and the language (English or Tamil), and say how sure you are before you check: knowing what you are unsure about is part of learning.

Classes 6–12: everyday examples, no prior knowledge. Practice only. Nothing here is graded or saved.

Question 1 / 4 · Order the steps of an algorithm

Put the steps of making tea in a sensible order. A clear list of steps like this is called an algorithm.

  1. 1Understand the problem
  2. 2Write the steps (algorithm)
  3. 3Write the code
  4. 4Test and fix
  1. Strain the tea into a cup
  2. Add sugar
  3. Serve hot
  4. Add tea powder and milk
  5. Boil the water
How sure are you?

Projects

Student Marks Manager (C with a C++ class version)

A tuition centre in Madurai records marks for 5 subjects per student on paper. Build a console program in C that stores student records, calculates totals and averages, assigns grades, saves everything to a text file and loads it again. Then rewrite the Student record as a C++ class.

Tasks

  1. Define a struct Student with roll number, name and five marks, and keep an array of students.
  2. Write functions for add, list, search by roll number, total/average and grade.
  3. Save all records to students.txt and load them when the program starts, handling a missing file.
  4. Write a test table with at least 8 inputs, including boundary marks such as 0, 34, 35 and 100.
  5. Rewrite Student as a C++ class with private data, a constructor with validation and a display() method.

Sample input

Roll 101, Name Anu, Marks 78 82 91 67 74

Expected output

Anu: total 392, average 78.4, grade B. The record is present again after restarting the program.

How it is assessed

CriterionWeight
Correct calculations and grades25%
Functions, structs and arrays used cleanly20%
File save/load with error handling20%
Test table and debugging evidence20%
C++ class conversion and readability15%

Stretch challenge: Add sorting by average and a menu option that lists the top three students.

How you are assessed

Each week: five short questions (concept, code-reading and one debugging item), a graded lab program with a test table and a two-line reflection on what failed first.

Practical work. Practical assessment on the learner's own code: compile cleanly, run against a test table, explain one function line by line and fix one seeded bug.

What trainers look forWeight
Correct output on the test table35%
Code structure and naming20%
Debugging and explanation25%
Documentation of tests20%

Where this can lead

  • Prepares you for entry-level programming practice and for advanced C/C++, Java or data-structure courses.
  • Builds the logic and debugging habits needed for software, embedded and systems study.

These describe skills you will build. ADIVAS does not guarantee jobs, placement or salary.