Learn C Programming - Full Course Free
Do you want to learn C programming for free?, Do you want to start programming career?, Do you want to explore C programming notes online?, then this Quick short C programming course is for you. Because in this Post, I will share you Complete C programming Course.
Learn C Programming - Full Course Free
Index
1)Introduction to C
=> What is C Programming?
Some Facts About C Applications of C Character Set of C => Why to learn or use C Programming
2) Basic Concepts in C
=> Variable, Constant, Keywords in C
=> Structure of C Program ( header files, main function, variable Declaration, scanf, printf )
=> Flow Chart & Algorithm
=> Flow of program in computer
3) Datatype in C
=> What is Data Type?
=> Classification of Data Type
=>"limits.h" header file
=>Size of operator
=> What is ASCII?
=> Why Char Datatype limits represent in integer?
=> Why any char Required 1 byte memory in computer?
4) Types of Instructions in C
=> What are Instructions in C?
=>Types of Instructions in C
Type declaration instruction (int,float,char) Arithmetic instruction or Operations (+, -, *, /, %) Control instructions Sequence Control Instruction Decision Control Instruction (if, if-else, (Conditional operators(?, :))) Loop Control Instruction(while, do-while,for) Case-Control Instruction(switch, break, continue, goto)
5) Operators in C
=>What are Operators in C Programming?
=> Types of Operators in C
Arithmetic Operators [Modify Operators (increment/decrement)] Relational Operators Logical Operators Bitwise Operators Assignment Operators Misc Operators =>Hierarchy of Operators / Operators Precedence Table
6) Functions & Recursion
=> What is Function (Syntax)
=> Parts of function (return type, identity, parameter, body)
=> Function Declaration
=> Calling a Function (call by value, call by reference)
=> Types of Functions in C ( Predefined Functions, User-defined functions)
=>Recursion
7) Pointers (*,&)
=> What is Pointer? (Syntax, Declaration)
=>Types of Pointers (Typed, Untyped)
=>Pointer to Functions
=>Dangling Pointer
8)Array
=> What is Array? (Syntax, Declaration)
=> How Memory Will be Allocated in Array Consept?
=> How to Access Array Elements?
=> How to initialize Array?
Methods=>Direct initialisation using Curly Braces, By assigning Values one by one, and using Loops) => How to process the elements of Array?
=> Local & Global Declaration of Array
=> Types of Array => (1d array, 2d array, md array)
=> Pointer to Array
9) String
=> What is String? (Syntax, Declaration)
=> How Memory Will be Allocated in String?
=> How to initialise a string?
=> How to Access the Elements of String?
=> How to Process the Elements of String?
=> string Handling Functions from "string.h" Header file:-
gets(), puts(), strlen(), strrev(), strcpy(), strcat(), strcmp().
10) Structure
=>What is Structure?
=> How Memory Will be Allocated in Structure?
=> How to Access the Members of Structure? (Accessor, Arrow Operator)
=> How to initialize Structure?
=> Size if Structure by sizeof() Operator (by variable, by struct type)
=> Local and global structure
=> Pointer to Structure
=> Array to structure
11) Union
=> What is Union in C? (Syntax, Declaration)
=> How memory will be allocated in union concept?
=> Size of union
=> How to access the members of union? (Accessor, Arrow Operator)
12) Dynamic Memory Allocation
=> What is static memory allocation?
=> Some problems in static memory allocation?
=> What is dynamic memory allocation?
=> How to allocate memory dynamically? (malloc, calloc, realloc, free)
=>Different b/w Dynamic & Static Memory?
13) File I/O
=> What is data?
=> What is data persistence?
=> What is file and uses of file?
=> What is file handling or file I/O
=> What is file pointer?
=> Basic file operations in C programming:-
Opening / Creating a file >> (fopen) (Syntax, Declaration) Closing a file >> (fclose) (Syntax, Declaration) Reading a file (fgetc, fscanf) Writing a file (fprintf, fputc)
14) typede
=>What is typedef? (Syntax, Declaration)
=> Examples of Typedef in:-
Primitive, Derived, User Defined dataType
15) Storage Classes
=> What represent storage class about variable?
=> Types of Scopes? (Block Scope, Method Scope, Program Scope)
=> Types of storage classes in C:-
Automatic storage class (auto) Register storage class (register) Static storage class (static) External storage class (extern)
16) Command Line Arguments
=>What is Command Line Arguments?
=> Who call main() function?
=> What are the different ways of run any C program?
(Using IDE, By Double Click, Command Line)
=> Components of command line Arguments (int argc, char *argv[])
=> Use of atoi(), and atof().
17) Graphics in C
=>What is Graphics in C?
=>How to initialise graphic mode in C? (initgraph())
=> How to close graphic mode in C? (closegraph())
=> Some more essential functions in graphic mode:-
Shapes related functions in Graphic mode (circle, bar, rectangle, line, ellipse) Colors related functions in Graphic mode (setcolor, setbkcolor) => Text Related Functions in graphic Mode (outtextxy, settextstyle)
=>function to Clear Screen in Graphic Mode
cleardevice();
Introduction to Programming Language
Q. What is Language and Computer Programming Language?
Ans.=> Language is a set of instruction or rules (grammer) by the help of which we can communicate to each other. For example we use Hindi and English language for communication.
We all know that computer is an electronic dump machine. To communicate with computer we need to use programming languages or Computer Languages like c,c++,java, python,etc…
Need of Computer Languages:-
We need computer languages to develop or create programs, after combining n number of programs one software is developed. Each of the program of software performing a particular task and these programs are developed through different different programming languages or may be same.
Why we Develop Programs & Softwares?
We create programs and softwares to solve particular problem in quick manner. The working speed of computer is much faster than human being that's why we develop softwares and programs for computer to perform any task in quick manner.
Q. What types of applications (Software) we can develop using programming languages?
Ans=> we can develop 2 types of application using programming languages :-
i) Standalone Applications:
the applications which must be installed in computer. This type of applications only compatible for single operating system. The application which are compatible for one operating system is not compatible for another operating system. These applications are always dependent to operating system.
For Example:
windows operating system having there own MS word, MS office, video player, audio player, etc
In another hand MAC operating system having their on MS word, MS office, video player, audio player, etc. We cannot use applications of one operating system into another operating system. That's why this type of application is called standalone application.
ii) Web Application:
the applications which can be used without installing in computer is called web applications. It is not mandatory to download this type of applications in the computer. These applications are independent (Not depend) to any operating system.
We can use these type of Applications in Any browser. There is no need to install them. standalone version of these web applications are also available but it is our choice to download them and to use them by browser.
For Example:
WhatsApp, Facebook,YouTube, Gmail, and all other social applications can be used in computer without installing and these applications are comes under web applications. In this type of application some payment transactions web applications are also include like icici bank.
Q. Why we are not using Standalone Applications in Another Operating System?
Because different different operating system having there own Extensions just like files. It is not possible to open .txt extension file in any mp3 player.because mp3 player can only understand .mp3 extension. The file having .txt extension can only be open in any notepad.
Just in same way we cannot use windows operating system applications in another operating system like MAC OS. Because windows application having .exe extension.
Windows OS =>> .exe,
MAC OS =>> .dmg,
Linux OS =>> .rpm, .tar, etc.
Note: C and C++ is used to Develop only Standalone Applications thats why major parts of different different OS is Developed through C and C++. In other hand through all other Programming Languages we can develop either web application or Standalone Applications.
1. Introduction to C
Q. What is C Programming?
Ans=> C is a programming language developed at Bell telephone laboratories in 1972 by Dennis Ritchie. It is one of the oldest and finest programming language. C programming language is reliable simple and easy to use structured programming language. Major parts of popular operating system like windows, Unix, Linux, etc are written in C. it is the most appropriate language for learning computer programming.
C programming language is high level language and in another high level language the Syntax rule of of C language is used hence it is the basic language for all other high level languages.
Some Important Facts about C :-
C is invented to Write Linux operating system. C is a successor of B language which was introduced around 1970. C was formalized in 1988 by the American National standard Institute (ANSI) Today's most popular Linux OS and RDBMS MySQL have been written in C She was originally first implemented on the DEC PDP-11 computer in 1972.
Applications of C:-
C was initially used for system development work, particularly the programs that make-up the operating system. It was initially used in System Development because it produces code that runs nearly the code of assembly language. Some examples of the use of C are -
Operating Systems, Language Compilers, Assemblers, Text Editors, Print Spoolers, Network Drivers, Modern Programs, Databases, Language Interpreters
Character Set of C Programming :- Alphabets => A to Z, a to z. Digits => 0 to 9. Special Symbols => ~ ! @ # % ^ & * ( ) _ - + : \ { } [ ] ; , < > . ? / $ "" ''
Q. Why to Learn or use C Programming
Ans=> we learn or use C Programming Because of Some Features and Advantages of C :-
- Easy to learn
- Structured language
- It produces efficient programs
- It can handle low-level activities
- It can be compiled on a variety of computer platforms
2.Basic Concepts of C
Variable, Constant, & Keywords in C
Variables
variables are the storage place where we can store n number of Values. We can store Data in computer through Variables. To store any value in computer we need to help variables. Through variables we can easily Store values in computer and also accessing them easily.
Ex.=> a=2, b='a', c=2.5
Rules for Declaring or Naming Variables in C programming :- The first character must be an alphabet or underscore(_). No commas, blanks allow. No special symbol other than underscore is allowed. Variable names are case sensitive
Constants
An entity whose value doesn’t change is called a constant. if we change value of constant during execution of program then we get compilation error. Constants are the values which are storaged in Computer thought Variables. Means variables holds constant values in them.
Types of constant Primarily there are 3 types of constant :-
Integer constant = -1,6,7,9 Real constant = -322.1,2.5,7.0 Character constant = ‘a’,’$’,’@’(must be enclosed within single inverted commas).
Keywords
keywords are predefined reserved words in a programming language. these keywords help us to use the functionality of C programming. Due to their special meaning we cannot be used them for other purpose.
There are 32 keywords available in C programming :-
auto
double
int
struct
break
else
long
switch
case
enum
register
typedef
char
extern
return
union
const
for
short
void
continue
float
signed
while
default
goto
sizeof
volatile
do
if
static
unsigned
The basic structure of a C program
All c programs have to follow a basic structure. A c program starts with the main function and executes instructions presents inside it. Each instruction terminated with a semicolon(;).
There are some basic rules which are applicable to all the c programs :-
- Every program's execution starts from the main function.
- All the statements are terminated with a semi-colon.
- Instructions are case sensitive.
- Instructions are executed in the same order in which they are written.
- For printing output of any C Program we Need to use predefined function of stdio.h header file Called printf( ).
- For taking input there is one more predefined function of stdio.h header file is used called scanf().
Program to add Two numbers / Program to add two Numbers / //Comment
#include // Header File with Preprocessor
void main() //Main Function
{ //Function Body Starting
int a,b,c; //Variable Declaration
printf("\n Enter two Numbers: "); //Output Statement for Taking Input
scanf("%d%d",&a,&b); //Input Statement
c=a+b; //Arithmetic Operation / Processing
printf("\nSum= %d",c); //Output Statement for Output Printing
} /Function Body End
Explanation of Above Program Structure :
Comments
Comments are used to understand program in better way. Comments are not executed by Compiler. Comment are not part of program. They are used for just small note about program Writer in program to understand program clearly. We can add comment anywhere in c program after terminating Instruction using semicolon.
There are 2 types of comment available in C:- Single line comment: //This is a comment. Multi line comment: /This is multi line comment/
Header files
In C programming collection of header files is called library and collection of related predefined functions is called Header files. To use any predefined function in c program we need to to declare related header file of this function before main function.
C library is consist of n number of header files and these header files having n number of related predefined functions. Each of the function in different different header file having special functionality to perform particular task.
There are n numbers of Preprocessors available in C and one of them is #include Preprocessor. With the help of Preprocessor #include we can Declare any header file in c program.
Ex.=> stdio.h header file contains n number of functions like printf(), scanf(), fprintf(), fscanf(), fopen(), fgets(), fputs(), etc…
Some Header files and their Functions :- math.h => pow(), rand(), sqrt(), etc..
graphics.h => setcolor(), setbkcolor(); circle(), bar(), line(), outtextxy(), textstyle(), etc…
string.h => strlen(), strrev((, strcat(), strcpy(), strcmp(), etc…
conio.h => clrscr(), getch(), getche((, textcolor(), textbackground(), etc...
main function
main function is a predefined function in c programming. This function is compulsory to to start writing any program because C program execution is starting from main function. Without main function execution of program is not possible.
We can also create other functions like main function but all other functions are calling directly or indirectly from main function. But main function is not calling from inside to program because it is a predefined function which is calling by operating system. We can pass arguments to main function by command line.
Variable Declaration
we all know that to store any value in computer we need to help variables. Through variables we can easily Store values in computer and also accessing them easily. In the declaration of a variable it is mandatory to to specify its data type. In C programming some predefined primitive data types are available to declare variables. These are int, float, char, and void.
int variable can hold one integer value in it float variable can hold one real (floating) value in it. char variable can hold one character value in it. void variable can hold one value of any type.
printf function
printf function is a predefined function of stdio.h header file. It is used in C program in 2 ways:-
- To take value from End-user.
- To print output of program.
Prototype or Syntax of printf function in 2 ways:- For Requesting input from End-user: printf("request statement (charstring)"); For Printing output of program: printf("ouput statement (charstring)", variables list);
scanf function
scanf is also predefined function of stdio.h header file which is used to store value given by End-user through printf function. To store value in variables we need address of operator (&). We can store n number of values in n Number of variables through scanf using format specifies and using address of operator (&) before variable name.
Prototype or Syntax of scanf function:- scanf ("formate specifiers",&variable1, &variable2,...);
Ex=> scanf("%d%f%c",a,b,c);
Flow Chart & Algorithm
Flow Chart
Flow Chart is a Pictorial or Diagrammatic Representation of Institutions of programs. With the help of flowchart we can easily understand flow of any program. flowchart uses various symbols to represent different operations involved in the solution of a program.
Following symbols are used to draw flow Chart of any program :- Algorithm Algorithm is a set of instruction to perform a given task in a definite time, written in normal English language is known as algorithm. Algorithm is a step-by-step procedure which define flow of execution of instructions one by one to produce desired output.
Characteristics of an Algorithm:
Unambiguous:- All the Steps Should be Clear and lead to be one meaning. Input:- should have 0 or more well defined inputs Output:- should have 1 or more well defined outputs. finiteness:- must be terminated after a finite number of steps. Feasibility:- Algorithm Should be Correct with Available Resources. Independent:- it should be independent of any programming language.
Flow of Program in C
Step 1: C program (source code) is sent to preprocessor first. The preprocessor generates an expanded source code.
Step 2: Expanded source code is sent to compiler which compiles the code and converts it into assembly code.
Step 3: The assembly code is sent to assembler which assembles the code and converts it into object code. (.o or .obj).
Step 4: The object code is sent to linker which links it to the library such as header files. Then it is converted into executable code. (.exe)
Step 5: The executable code is sent to loader which loads it into memory and then it is executed. After execution, output is sent to console.
Original Credit: www.dheerajpatidar.com
Subscribe to my newsletter
Read articles from Dheeraj Patidar directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Dheeraj Patidar
Dheeraj Patidar
In this site I'm presenting the content about digital marketing, online jobs, programming languages, and other technical aspects.