Programming in C (312303): Detailed Notes & Question Bank

Published by MSBTE Notes Team ∙ 20 min read

Programming in C Banner

Unit I: Basics of ‘C’ Programming

1.1 Fundamentals of Algorithms

An algorithm is a step-by-step procedure to solve a specific problem. It acts as a blueprint for your code. Before writing any program, it is crucial to define the logic clearly.

1.2 Structure of a C Program

A C program has a specific structure that the compiler expects:

#include <stdio.h> // Header File: Contains standard Input/Output functions int main() { // Main Function: Execution starts here printf("Hello!"); // Statement return 0; // Return value }

1.3 Variables, Constants, and Data Types

Variables are named storage locations in memory (e.g., int age = 20;).
Constants are fixed values that do not change during execution (e.g., const float PI = 3.14;).

Basic Data Types:

1.4 Input and Output Functions

The stdio.h library provides functions for communication with the user:


Unit II: Control Structures

2.1 Conditional Branching

Decision-making structures allow the program to execute code blocks based on conditions:

2.2 Loops (Iterative Statements)

Loops are used to repeat a block of code multiple times:

2.3 Jump Statements

Used to transfer control unconditionally:


Unit III: Arrays & Structures

3.1 Arrays

An Array is a collection of elements of the same data type stored in contiguous memory locations.

One-Dimensional Array: List of items (e.g., Marks of 5 students).
int marks[5];

Two-Dimensional Array: Grid or Matrix format (Rows x Columns).
int matrix[3][3];

3.2 Strings

In C, a String is simply a character array terminated by a null character '\0'.
Common operations include finding length (strlen), copying (strcpy), and concatenating (strcat).

3.3 Structures

A Structure allows you to combine data of different types under a single name. Consider a student record:

struct Student { int roll_no; char name[20]; float percentage; };

We can create an Array of Structures to store records for multiple students efficiently.


Unit IV: Functions

4.1 Need for Functions

Functions allow modularity. They break large programs into smaller, manageable, and reusable pieces ("Divide and Conquer").

4.2 Types of Functions

4.3 Parameter Passing

4.4 Recursion

Recursion occurs when a function calls itself. It needs a base case to stop infinite looping. Example: Factorial calculation (5! = 5 * 4!).


Unit V: Pointers

5.1 Introduction to Pointers

A Pointer is a variable that stores the memory address of another variable. It is a powerful feature for direct memory manipulation.

5.2 Pointer Arithmetic

We can perform addition and subtraction on pointers. Incrementing an integer pointer (ptr++) moves it forward by 4 bytes (depending on system architecture), pointing to the next integer location.


Exam Question Bank (Important)

Unit I: Basics

  • Define Algorithm and Flowchart. Draw the flowchart symbols.
  • Explain the structure of a C program with an example.
  • Differentiate between 'Variables' and 'Constants'.
  • Explain the usage of bitwise operators in C.

Unit II: Control Structures

  • Differentiate between 'while' and 'do-while' loop.
  • Explain specific use cases for the 'break' and 'continue' statements.
  • Write a program to demonstrate the 'switch case' statement for a simple calculator.
  • Explain the 'if-else ladder' with syntax and example.

Unit III: Arrays & Structures

  • What is a two-dimensional array? How is it initialized?
  • Differentiate between 'Array' and 'Structure'.
  • Write a program to find the length of a string without using library functions.
  • Explain 'Array of Structures' with an application example.

Unit IV: Functions

  • Explain 'Call by Value' vs 'Call by Reference'.
  • What is Recursion? Write a recursive function to find the factorial of a number.
  • Explain scope of variables: Local vs Global.
  • List any four string handling library functions with syntax.

Unit V: Pointers

  • What is a Pointer? Explain how to declare and initialize it.
  • Explain pointer arithmetic with an example.
  • How do you access structure members using a pointer?

❓ Frequently Asked Questions

Q: Is this subject difficult?

A: C is a logical language. If you focus on understanding the logic (Algorithms/Flowcharts) first, the coding part becomes easy.

Q: What is the paper pattern?

A: The theory paper is of 70 marks. Unit II and III carry the highest weightage (16 marks each).

Q: Do we need a laptop for this course?

A: While beneficial, you can also practice basic C programs on mobile using online compilers like Programiz or apps like Coding C.

Share this content 📤