Nov.29

C Programming Tutorial – Basic

C Programming Tutorial – Basic

In this series of video tutorials of C Programming Language I am going to give you basic concept on C Programming Language. I have tried my best to make these tutorials as practical as possible. So, watch these tutorials and don’t forget to give your valuable feedbacks.

Tutorial 1 – Download And Install Code Blocks

In this video you are going to learn how to download and install Code Blocks which is one of our preferred C Language compilers.

Tutorial 2 – Hello World

In this video I am trying to explain you the basic structure of the C Language and show how to print Hello World on the display screen.

Code Snippet:

#include<stdio.h>
int main(){
  printf("Hello World!");
}

 

Tutorial 3 – Variables, Basic Operators & Data Types

In this video I am explaining the basic concept of variables, basic operators and data types in C language.

Code Snippet:

#include<stdio.h>
//program to demonstrate variables, operators and data types
int main(){
  int a, sum;
  int b=5;
  float f=3.14;
  double d=4.23564345;
  char ch='A';</pre>

  printf("Enter a Number: ");
  scanf("%d", &a);
  sum=a+b;
  printf("A+B=%d", sum);
  return 0;
}

 

Tutorial 4 – If Else

In this video the structure of IF-ELSE statement in C Programming language in explained as easier as possible.

Code Snippet:

#include<stdio.h>
int main(){
  int age;
  printf("Enter Your Age: ");
  scanf("%d", &age);
  if(age<18){
    printf("You are not eligible for Voting!!!");
  }
  else{
    printf("You are eligible for voting!!!");
  }
}

 

Tutorial 5 – Switch Case

In this video what is switch case and how it is used in C Language is explained. I also have shown here the structure of the switch case.

Code Snippet:

#include<stdio.h>
int main(){
  int n;
  printf("Enter a Number: ");
  scanf("%d", &n);
  switch(n){
    case 1:
      printf("One\n");
      break;
    case 2:
      printf("Two\n");
      break;
    case 3:
      printf("Three\n");
      break;
    default:
      printf("Not 1, 2 or 3.\n");
  }
}

 

Tutorial 6 – For Loop

In this video I have explained about looping concept in C Language using FOR Loop.

Code Snippet:

#include<stdio.h>
int main(){
  int i;
  for(i=1; i<=10; i++){
    printf("Hello!\n");
  }
  return 0;
}

 

Tutorial 7 – While Loop

In this video also I am explaining about looping concept in C Language but this time using WHILE loop.

Code Snippet:

#include<stdio.h>
int main(){
  int i=1;
  while(i<5){
    printf("%d\n", i);
    i++;
  }
  return 0;
}

 

Tutorial 8 – Do While Loop

This video tutorial contains the explanation of DO-WHILE loop in C Programming language. It also contains the structure of this loop.

Code Snippet:

#include<stdio.h>
int main(){
  int i=4;
  do{
    printf("Hello!");
    i++;
  } while(i<5);
  return 0;
}

 

Tutorial 9 – Operators

In this video I have explained the basic concepts of mostly used operators in most of the languages.

Code Snippet:

#include<stdio.h>
int main(){
  int age;
  printf("Enter Your Age: ");
  scanf("%d", &age);
  if(age<18)
    printf("You are below 18!");
  else if(age>=18 && age<=60)
    printf("Your age is in between 18 and 60!");
  else
    printf("You are above 60!");
  return 0;
}

 

Tutorial 10 – Functions

This video tutorial contains the most powerful feature of any programming language, but here I have explained for C Programming Language.

Code Snippet 1:

#include<stdio.h>
void println(){
  printf("\n--------------------------------------\n");
}
int main(){
  printf("Let's Start Learning C!!!");
  println();
  printf("By Nepali Coders...");
  println();
  return 0;
}

Code Snippet 2:

#include<stdio.h>
int sum(int a, int b){
  int sum = a+b;
  return sum;
}
int main(){
  int x, y, result;
  printf("Enter Two Numbers: ");
  scanf("%d%d", &x, &y);
  result=sum(x,y);
  printf("Sum=%d", result);
}

 

Tutorial 11 – Arrays

This video contains the explanation of arrays and how it is used to store data in sequence and how the strings are stored in C Programming Language.

Code Snippet 1:

#include<stdio.h>
int main(){
  int array[5];
  array[0]=12;
  array[1]=15;
  array[2]=13;
  printf("Array[1]=%d\n", array[1]);
  printf("Array[0]=%d\n", array[0]);
  printf("Array[2]=%d\n", array[2]);
  return 0;
}

Code Snippet 2:

#include<stdio.h>
int main(){
  char str[20];
  printf("Enter Your Name: ");
  scanf("%s", str);
  printf("Hello, %s", str);
  printf("\n%c", str[2]);
  return 0;
}

 

That’s all, hope you friends enjoyed this series of video tutorials. If you friends have any questions, suggestions or want to give any feedback, you can mail me or contact me through contact form. I am happy to hear from you and bring improvements. Thank You!

Tutorials
Share this Story:
  • facebook
  • twitter
  • gplus

About Sulav Neupane

Leave a comment

Comment