Skip to content

This repository contains the programs in C illustrated during the sessions.

Notifications You must be signed in to change notification settings

courseonprogramminginc/C-Programs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C-Programs

This repository contains the programs in C illustrated during the sessions.

Day 1: Structure of C program and Variables

  1. Hello world program which gets completely modified to understand range of values int can store.
  2. Variable declaration to understand how to declare variables.
  3. Addition of two numbers to take two numbers as input and add them!

Day 2: Data types, I/O, Operators

Data Types

  1. int, char, float, double: Basic Data Types
  2. Question on float type: question1
  3. long and long long: long

Input and Output

  1. scanf
  2. printf

Operators

Binary Operators

  1. Arithmetic Operators
  2. Assignment Operators
  3. Logical Operators

Day 3: Conditional statements

If conditional statement

Simple program using if: if

If Else conditional statement

  1. Simple program using if...else: ifElse
  2. Question on finding output of if...else: question

Day 4: More on conditionals

If Else If ladder

Program to print grade given marks

Nested If Else

  1. Motivation
  2. Improved version of program above

Switch Case statement

Program to print day of week given day number

Side Learnings

  1. ASCII values for character
  2. Bitwise Operators

Day 5: Getting started with Loops

  1. Why do we need loops?
  2. For loop
  3. Exercise based on for loop

Day 6: More on Loops

  1. Factorial of n using while loop
  2. Find sum of digits of a number
  3. do...while loop
  4. Infinite loops

Nested loops

  1. Multiplication table using nested loops

Day 7: Jump statements

Break, continue and goto

  1. Example program to understand break
  2. Example program to understand continue
  3. Example program to understand goto

Usage of break

  1. Check whether given number is prime

Creating your own functions

  1. Sum of first n prime numbers

Day 8: Introduction to Pointers

  1. Nested Loop: Pattern printing

  2. Two functions to swap numbers

    The first function doesn't work. We try to understand why that doesn't work. An introduction to pointers and memory is provided. Referencing and Dereferencing operators are discussed.

Day 9: Introduction to Arrays

  1. Understanding object and value contexts
  2. Introduction to arrays
  3. Array Initialization
  4. Character Array

Day 10: Pointer arithmetic and Array examples

  1. Character array vs String in C
  2. Understanding various declarations
  3. Pointer arithmetic
  4. Array value rule
  5. Count no. of words in a line

Day 11: Functions in C

  1. Call by value
  2. Simulated Call by reference
  3. Fibonacci Function
  4. Max of three numbers function
  5. Recursive functions

Day 13: Passing arrays to functions and 2D arrays introduction

  1. Passing arrays to functions
  2. Reference variables in C++
  3. Introduction to 2D arrays

Day 14: Array of arrays, Typecasting, Macros, Static variables

  1. Understand array of arrays
  2. Implicit Typecasting
  3. Explicity Typecasting
  4. Constants in C
  5. Macros
  6. Static variables

Day 15: Structures in C

  1. Declaring and using structure
  2. Nested structures
  3. Updating structure fields

Day 16 Unions, Enum and Void pointers

  1. Understanding Unions and Enumerations
  2. Struct, union and enum all at once
  3. Void pointer

Day 17: Dynamic Memory Allocation

  1. malloc function
  2. calloc function

About

This repository contains the programs in C illustrated during the sessions.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published