C For Technical Interview

C language tutorial from basics with C operator,loop,array,pointer,function,parameter,string,recursion,structure,file.

Last updated 2022-01-10 | 4.3

- if else statements
- loop - while
- for and do while loop with many examples.
- Array - 1D and 2D
- why we need them and how to use them effectively.
- String in C - NULL terminated character arrays.

What you'll learn

if else statements
loop - while
for and do while loop with many examples.
Array - 1D and 2D
why we need them and how to use them effectively.
String in C - NULL terminated character arrays.
Writing function
parameter passing to function. Returning value from function.
storage class - auto
static
extern and register
Pointer - in depth understanding.
Relationship between arrays and pointers.
Array of pointers.
Command line arguments
Reading and writing with files
both text and binary.
Recursion - how it works
recursion vs iteration in depth discussion - Towers of Hanoi
Various string utilities - sprintf
strtok and many others
Function pointers
bitwise operators in C programming.

* Requirements

* No prerequisites
* course is for absolute beginners.

Description

  • if else statements, loop - while, for and do while loop with many examples.
  • Array - 1D and 2D, why we need them and how to use them effectively.
  • String in C - NULL terminated character arrays.
  • Writing function, parameter passing to function. Returning value from function.
  • storage class - auto, static, extern and register
  • Pointer - in depth understanding.
  • Relationship between arrays and pointers.
  • Array of pointers.
  • Command line arguments
  • Reading and writing with files, both text and binary.
  • Recursion - how it works, recursion vs iteration in depth discussion - Towers of Hanoi
  • Various string utilities - sprintf, strtok and many others
  • Function pointers
  • bitwise operators in C programming.

Course content

21 sections • 197 lectures

Introduction Preview 02:04

A note on screen resolution. Preview 00:09

Course dash-board, Q/A section, basic guidance to follow the course. Preview 08:10

How to do the coding exercises, please watch. Preview 07:21

A brief note on IDE and Compiler Preview 04:26

Download install and use Xcode(on OSX) for writing C programs Preview 06:21

This video will guide you to download, install and use Xcode for your Mac OSX. Xcode is a powerful IDE and best choice for OSX users. It is available for free, also when you install Xcode you get the C, C++, swift and Objective-c compiler installed on your Mac as well.

Compile using Mac terminal and write program on sublime text. Preview 09:08

In this video you will learn how to write your C program using a text editor like Sublime text and then how to compile and execute your program from the terminal of MacOS.

Using Visual Studio Code on MacOS for C program. Preview 07:49

How to download and install Codeblocks for Mac Preview 06:43

This lecture will show you how to use Codeblocks under Mac, if you are using Windows and willing to use Codeblocks just see the next lecture.

Download Install and Use Code::Blocks for your C programs. Preview 10:33

This video tutorial will demonstrate how you can download, install and use Code::Blocks IDE for your Windows operating system along with the MinGW compiler.

Compiling from Windows terminal using gcc Preview 07:10

Using Visual Studio Code for Windows. Preview 12:01

Download, install and use Microsoft Visual Studio 2019 Community edition. Preview 12:41

This lecture will walk you through the process of downloading and installing the Visual Studio 2019 Community Edition for your Windows machine, after that you will also experience how to create a C project and build and run that under this powerful IDE.

Using Netbeans in Mac Preview 05:50

This tutorial shows how to use netbeans IDE for C projects. How one can create a project, how to compile and execute.

Understanding the first program. Preview 15:09

In this tutorial you will understand each part of the program that prints "Hello, World!" into the console.

Just print Hello World

Variables and data types in C programming. Preview 09:37

In this video you will learn about variables, data types and how to declare variables.

Printing content of variable using printf Preview 04:27

This video will teach you how to print content of a variable into console using printf.

Reading data from keyboard into variable using scanf. Preview 10:20

In this video you will learn how to read data from keyboard and assign that into a variable using the scanf function.

Have you understood printf and scanf?

Initialization of variable, octal and hexadecimal initialization. Preview 06:31

Arithmetical Operators in C Preview 02:47

Do some arithmetic work

Console I/O and Variable declarations

Test your skill on printf and scanf

Dealing with characters Preview 09:01

Characters - Do you know them?

Quiz to test your skill about characters and how they are represented.

Flushing problem while taking character input Preview 05:34

Idea of casting Preview 04:05

Assignment to test your idea about data type casting.

You learned about data type casting in the last lecture now try this program to check your knowledge.

The secret of printf Preview 02:32

The secret of scanf Preview 02:16

The most neglected operator - Assignment operator Preview 01:51

Relational operators for comparing values Preview 04:44

Can you take this challenge? Preview 01:43

Introduction to Logical Operator, AND operation Preview 06:51

Logical OR operation Preview 04:12

Logical NOT operation Preview 04:27

Unary increment and decrement operator Preview 10:37

Short circuit feature of AND and OR operation Preview 04:28

How concrete is your foundations

Test yourself, how strong you are on the very basic things like variable declarations, operators, initialisation.

"To be or not to be" - how to decide using if-else Preview 10:56

Going further, the if-else-if structure Preview 04:47

"Mood of Pupeta the funny creature" - Test your skill on if-else

Simple test for if-else statement.

Another programming example on if-else-if, this will help you more. Preview 05:30

Are you sure you can answer this? Take a look. Preview 01:55

Ops! Not done yet, here is some more information on if-else Preview 03:37

Print remark according to the age.

Make it smart using conditional operator, the only ternary operator in C Preview 05:01

Nested if-else, checking leap year. Preview 09:29

Understand switch-case Preview 10:41

Switch case statements can be suitable alternatives to if-elseif sometime. 

Decision making, how bold you are?

Quiz on if-else structure. You need to take decision firmly, always, are you sure?

Practice if-else statement

Practice if-else statement with this Assignment.

Introduction to loop, while loop. Preview 05:05

Quiz on While loop

While loop - Programming Example 1 Preview 06:55

While loop - Programming Example 2 Preview 03:24

Find sum of all numbers which are divisible by 3 but not divisible by 5 up to a positive integer n.

Take a challenge on while loop, here is interesting "predict output" on while. Preview 03:59

Assignment: While loop - 1

Test your understanding on while loop. You will develop a program that will print a menu and will ask the user to input menu option, then it will perform the task according to the menu option.

All about smart looking for loop Preview 12:27

Pattern Printing

Watch the video and the have fun doing this assignment.

First do then check, do-while loop Preview 08:14

How to break a loop early: use of 'break' keyword Preview 03:29

The other loop utility: 'continue' keyword Preview 02:55

Generating random numbers, the rand() function Preview 09:12

There is a coding exercise, hi_low_dame.c, download the file and try that. I have written all the comments there. Just read the comments and follow the instructions.

Quiz 3. Check how you can iterate.

To check how you have understood the concept of loops.

Hi_Lo_Game

Implement your knowledge on loop and rand function

A dice game

Guess the sum of values of two rolled dice. The rolling will be done by the computer.

Introduction to one dimensional array Preview 08:47

Initialisation of one dimensional array Preview 02:25

Allocating array dynamically, Example input output operations with array Preview 04:18

A programming example using 1-D array Preview 08:04

One dimensional array - first assignment.

Try your acquired knowledge for accessing one dimensional array using loops. This simple assignment will help you to test your understanding with one dimensional array.

Second assignment on one dimensional array

This assignment will again your understanding with one dimensional array. You will try to represent a positive integer with one dimensional array in this assignment.

Introduction to two dimensional array Preview 11:34

2-D array programming example Preview 08:09

Print transpose of a matrix.

In this assignment you will write a program that will print transpose of a Matrix, you will use 2 Dimensional array for the purpose.

Generate Magic Square

You will use 2 dimension array to generate a magic square for odd dimension using a given algorithm. Find the attached PDF file for all details.

Are you comfortable with 1-D arrays?

The purpose of the quiz is to test your acquired knowledge on 1-D arrays.

Test your understanding with 2 Dimensional arrays.

In this quiz you will get questions on 2 dimensional arrays that will help you to judge your foundation on 2-D arrays, good luck!

Introduction to string, using character array for storing string Preview 07:15

How to input string from keyboard Preview 07:06

Finding the length of string Preview 05:40

Searching and counting target in string Preview 04:51

Library function for string operations, string.h Preview 06:30

Find longest word in a string

This assignment will require understanding of string, nested loops and arrays.

Check if a string is a Palindrome or not.

A palindrome is a string that reads same both in forward and backward direction. Example: Madam, or "Cigar? Toss it in a can. It is so tragic." You will write a program to test if a given string is a palindrome or not.

count frequency of digits in a string.

Quiz on string (NULL terminated character array)

This quiz will test your understanding on string or NULL terminated character arrays.

Introduction to function Preview 10:32

Prototype or signature of function, declaring a function. Preview 06:41

Write a simple function.

Quiz on Function preliminaries

Create your own library, distribute functions to others. Preview 13:46

Function example 1, a function to check prime number Preview 09:29

More example on function Preview 05:58

Another example, a function to test Armstrong Number Preview 13:30

Write a function to to check a character.

Develop a function to find the area of a rectangle.

Find sum of all prime numbers upto n.

Quiz on function

Will test your understanding with function

Rock-Paper-Scissor game - Part 1 Preview 07:07

Let's write a program to simulate a simple Rock-Paper-Scissor game where one player would be the user and the other is the computer.

Rock-Paper-Scissor game - Part 2 Preview 13:46

Rock paper scissor game continues...

Introduction to recursion. Preview 07:59

Introduction continues... Preview 06:53

Recursion vs Iteration, the big debate, Concept of TAIL recursion. Preview 07:17

The debate continues... when exactly iteration is preferable. Preview 09:20

Still in debate... when recursion is preferable. Preview 09:29

Tower of Hanoi, the classical example of recursion. Preview 06:21

Implementation of Tower of Hanoi Preview 07:08

Another example, Fibonacci term. Preview 03:17

Test your knowledge on recursion.

This quiz will help you to test your acquired knowledge on recursion. Good luck!

Introduction to storage class, the auto storage class Preview 11:27

Storage class: static Preview 03:25

Storage class: extern Preview 10:28

Storage class: register Preview 04:23

Check your knowledge on Storage Class.

Conception of stack and heap memory Preview 04:48

Introduction to pointers Preview 09:15

Introduction to pointers, continues... Preview 05:23

Introduction to pointers, continues... Preview 07:00

Address arithmetic Preview 08:44

More on pointers Preview 04:11

Quiz on Pointers - 1

How and when to use pointers in C program Preview 07:45

update values from function at the original location.

More programming example Preview 04:34

Relationship between one dimensional array and pointers Preview 09:45

Passing one dimensional array to function Preview 06:22

More example on passing one dimensional array to function Preview 05:05

Passing one dimensional array as parameter.

Colony with 8 cells - simulation. Preview 15:53

One more example - Passing a string (character arrays) to function Preview 10:09

You will learn how you can pass string (that is NULL terminated character array) to function and how you can use the base addresses of character arrays passed to the function for updating the arrays from the function.

We will write a simple split method that will split a string like "book*abacus" into 2 parts, the first part will contain book and second will contain abacus. We will consider a single delimiting character '*' just to make the things simple.

Writing functions to convert all cases of a string received by the function.

use of const keyword with pointer Preview 08:24

Add some more glue Preview 08:56

The generic pointer is void pointer Preview 02:49

Dynamic memory allocation - malloc function Preview 12:44

Dynamic memory allocation - calloc function Preview 02:24

Dynamic memory allocation - realloc function Preview 05:00

Immutable property of string literals Preview 02:35

Array of pointers - part 1 Preview 10:31

Array of pointers-part 2(Simulation of dynamic 2D array using array of pointers) Preview 12:06

Introduction to User Defined Type, struct keyword Preview 07:51

typedef keyword, creating alias to type Preview 05:12

Using Structure 1

pointer to struct object Preview 02:43

Using structure 2

Writing behaviour (functions) for struct types - part1 Preview 07:57

Writing behaviour (functions) for struct types - part2 Preview 05:40

Using struct type within another struct type Preview 02:12

declaring enumerated constants, enum keyword Preview 08:15

Only one at a time in group, use of enum keyword Preview 09:20

How to pass variable arguments to function. Preview 07:38

Passing variable arguments of different types Preview 07:42

Command line arguments, parameters to main method Preview 10:07

Command line arguments - more example Preview 06:34

Passing cmd line args in Netbeans Preview 02:07

How to pass command line arguments in Codeblocks Preview 01:32

Get information about environment, the environmental parameter in main Preview 02:10

Quiz on command line arguments

Introduction to file handling, writing characters into a text file using fputc() Preview 12:47

Reading content of a text file character by character using fgetc(). Preview 06:28

Reading a line from text file into a character array using fgets function Preview 04:47

Reading formatted data from text file using fscanf fucntion Preview 04:41

Writing formatted data into text file using fprintf function Preview 04:05

Formatted data reading and writing - another example Preview 06:39

Writing in binary mode - fwrite function Preview 06:20

Reading in binary mode - fread function Preview 04:16

Moving the file pointer at any desired location using fseek Preview 10:24

Calculating the number of records in a binary file using ftell Preview 05:52

A program to copy any file - Introduction Preview 04:11

I will show you how to write a program that is more-or-less equivalent with the cp command of Linux. This program will be able to copy any type of file. Both the source and destination file path should be supplied as command line parameters.

In this tutorial I will give you brief introduction and demonstration of the program, I will show you the execution of the program so that you can understand clearly the working, then in the next tutorial I will develop the program from scratch, step-by-step.


Let us Develop the file copy program step by step. Preview 17:06

Here in this lecture I will develop the file copy program step by step. I will explain each line of code while I develop the program. I want you to follow along with me by writing the code simultaneously on your computer. Before you could proceed with this tutorial I will recommend you to view the previous tutorial where I gave the demo of execution of the program that we are going to develop in this tutorial. Also, you will need understanding of command line arguments, fread, fwrite, fseek and ftell functions - I have discussed each if these earlier.

Introduction to bitwise operators Preview 05:00

Brief introduction to bitwise operators, how and when they are used.

Bitwise leftshift operator Preview 02:44

Understand the operation of bitwise left-shift operator.

Bitwise right shift operator Preview 03:32

Learn all about bitwise right shift operator.

Bitwise AND operator - how to check a bit. Preview 08:11

Bitwise AND operator is used for anding corresponding bits of 2 values, can be useful for checking if a particular bit is 0 or 1.

Count set bits - Using bitwise AND and left shift. Preview 05:55

A program that counts the number of set bits in a signed integer value, good example of using bitwise AND and Leftshift operators.

Print the signed integer as it is. Preview 04:21

This lecture develops a program that prints the bit configuration of a signed integer number as it is there  in the memory.

Bitwise OR operation - How to set an unset bit? Preview 05:39

Using bitwise OR you can set a particular bit to 1 if that is 0, otherwise if that is 1 it will be 1 after the operation.

Bitwise XOR operation. Preview 03:50

Learn how to toggle a particular bit.

Bitwise complement - invert every bits. Preview 02:50

How to flip every bit of a signed integer number.

Developing a function equivalent of bitwise complement operator.

You would require to develop a function named flip(int n) that is suppose to do the equivalent task of bitwise complement operator, that is, it should return an integer where each bit if n is flipped.

sprintf and snprintf - Write formatted string into character array Preview 07:11

This video lecture will guide you on how to use sprintf and snprintf in your C program, both of these functions can be used to write formatted string into a null terminated character array.

Function sscanf - how to scan formatted data from a string Preview 05:56

You will learn how we can scan formatted data from a character array (string). 

strtok - great tool to extract information from a string separated by delimiters Preview 05:19

How you can separate information from a string which are delimited by different characters, you can do it in a sec using strtok.

memset - learn how to initialize block of memory with a character using memset Preview 03:35

Use memset to initialize a block of memory with a specific character.

memcpy - copy from one memory block to other byte-by-byte Preview 05:31

If you need to copy content of one memory block to other then this is really useful.

clock function to count number of clock ticks and measure elapsed time. Preview 04:32

You can easily measure elapsed time during processing of some particular function or loop using clock function.

Bubble Sort Algorithm Preview 13:26

Understand how we can sort an array using Bubble Sort Algorithm. In this lecture I will explain the algorithm step-by-step. In the next lecture you will learn how we can implement Bubble Sort using C language.

Bubble Sort Implementation Using C Preview 07:07

Learn how to implement bubble sort in a C function. Students must complete the sections covering function and pointers before viewing this. You must be able to pass an array to a function and also must know dynamic memory allocation technique.

Improving the Bubble Sort further, how to exit the loop for early sorting. Preview 04:38

Understand how we can exit the outer loop as soon as the array is sorted using a flag.

How to use library qsort function for sorting arrays. Preview 05:57

While writing professional C program, you do not need to implement a sort function of your own for sorting arrays, instead the qsort function available in stdlib can be used. Let's understand how we can use this standard C function.

Function Pointer Introduction Preview 02:58

Introduction to the chapter. You will learn that the name of the function holds the address of the function.

Learn how to declare a function pointer. Preview 06:26

Here you will learn how to declare a function pointer for a particular type and how you can call a function using function pointer.

Function pointer in Action - Program that uses function pointer Preview 10:09

Understand with a comprehensive example how we can use function pointers in a C program.

Bonus Lecture: Referral links to my other Udemy Courses - Your next step. Preview 00:37

Next step is to learn Data Structures and Sorting algorithms. I have courses on both on Udemy. There is another course on Number System. You can get discounted coupon code with minimum price in this lecture. Best wishes.