Posts

Showing posts from May, 2021

Looping in C Programming Language

 Looping in C Programming Language Use: When we want to perform specific task repeatedly then we can use looping. In C Language there are three type of loop: For Loop While Loop Do while Loop Nested for Loop Each Loop statement requires three things: Initialization  Test Condition Increment/Decrement Operation 1. For Loop: For Loop is a repetition control structure which allow us to write a loop that is executed a specific number of time. Syntax:               for( initialization ; test condition; increment/decrement operation)                 {                    ------                    body of for loop;                    ------               } 2. While Loop: While Loop is use to per to p...

Data Types in C Program

Image
 DATA-TYPE IN C PROGRAM Data type is a type of data that specifies internal storage representation. There are three types of data types: Primary/basic/fundamental data type. Derived data type. User defined data type. PRIMARY DATA TYPE: Int Data Type: Int datatype is use to declare variable that holds whole numbers. Int requires 2 bytes. It can be signed or unsigned. Ex. int a,b,c; We can declare int, short int or long int variables. Char Data Type: Char datatype is use to declare a variable that holds alphabets, numbers or special character like *, @, !, _, $ etc... This datatype holds single character which is specified by single quote (' ').  It requires 1 byte. Ex. char a='A'; Float Data Type: Float datatype is use to declare a variable that holds real number with fractional part (.). It requires 4 bytes. We can give 6 numbers/digits after fractional part. Ex. float f=10.55;     O/T f=10.550000 Double Data Type: Double datatype is use to declare a variable th...

Definition of variable in C Language

 DEFINITION OF VARIABLE IN C LANGUAGE Variable is a name of data which is used to store and hold value. Example: int a,b,c; Here, int - integer is a keyword and data type and a,b,c are variable name. Variable name should be meaningful and short. Example: int avg; Rules of Variables: It can be lower case and upper case. It includes alphabets, numbers, underscore. It doesn't start with number or digit. It doesn't contain white-space. It can't use a keyword. We can give 31 letter. Example: int TOTAL;---right float _sum;---right int stu rollno;---wrong int 1no;---wrong int auto;---wrong  

Tokens in C Language

Image
 TOKENS IN C PROGRAMMING LANGUAGE Smallest individual unit of C Program is known as Token . There are Six types of tokens:      1. KEYWORD: In C Program a word which has fixed meaning is called keyword . During program its meaning is not changed. All keyword are in lower-case . There are 32 keywords :     2. IDENTIFIER: Identifier is a name of variables and user defined function .             Rules of Identifier: It can be in lower case or upper case. Ex. int total; , int TOTAL;. It includes alphabets, numbers, underscore. Ex. int no1;. It doesn't start with number/digit. Ex. int 1no;--(wrong) , int _no;--(right). It doesn't contain white space. Ex. int stu no;--(wrong) , int stu_no;--(right). It can't use a keyword. Ex. int void;--(wrong). We can give 31 letters. 3.CONSTANTS: Constant:   Constant is a fixed value which can't be changed during the execution of program. There are three types of constants:...

History of C Program

Image
 HISTORY OF C PROGRAM C Language is a high level, structured and machine independent language. C Language was developed by DENNIES RITCHIE in 1972 at BELL LABORATORIES . 1. ALGOL: ALGOL is a roof of all modern programming languages. It was developed by International group in 1960 . It is first programming language to create Block Structure .      2. BCPL: BCPL is a Basic Combined Programming Language . It was developed by Martine Richards in 1967 . These language is use to create System Software .     3. B: In 1970 , Ken Thompson added features in BCPL. These language is known as B Language. B Language is use to create version of Unix operating System.     4. TRADITIONAL C: Traditional C was developed by Dennies Ritchie in 1972 . He has added features like data-types, System defined function, System libraries etc... to create user program.   5. K&R C: In 1978 , Kernighan and Ritchie have published a book "THE C PRO...

Structure of C Program

Image
  STRUCTURE OF C PROGRAM C Program has following sections: 1.Documentation Section:     In these section, we can write details about program and programmer. Like - program title, user/student name, roll no, semester etc... These details can we given in comments. Comments can be given in two ways:         A. Single Line Comment: We can give comment in single line                   using // .                 Ex. //WAP to find percentage.         B. Multiple Line Comment: Multiple lines comment can we                       give using /* ------------*/ .               Ex. /* Program title: WAP to find percentage.                            ...

Different Modules to solve the program/problem

Image
DIFFERENT MODULES TO SOLVE THE PROGRAM/PROBLEM Algorithm Flow-Chart Program 1. Algorithm: Algorithm is a step by step procedure to perform any task. In Algorithm, we write our logic in textual manner (Statement). 2. Flow Chart: Graphical representation of an algorithm is called flow chart. In flow chart there are different symbols: 3.Program: Using of algorithm and flow chart we can perform program easily. 

Steps for Solving Problem/Program in C Programming Language

  STEPS FOR SOLVING PROBLEM/PROGRAM IN C PROGRAMMING LANGUAGE Step 1:  Understand the program/problem. Step 2: Think about program/problem (Analysis). Step 3: Do rough work using models like Algorithm and Flow chart. Step 4: Write set of instruction in Editor. Step 5: Test our program and check errors are occurred or not. Step 6: If errors are occurred then solve those errors. Step 7: If errors are not occurred then execute the program. Step 8: Check the Output.

DIFFERENCE BETWEEN COMPILER AND INTERPRETER

Image
  DIFFERENCE BETWEEN COMPILER AND INTERPRETER  

STEP OF EXECUTION OF C PROGRAM

Image
 STEP OF EXECUTION OF C PROGRAM During the execution of C program following steps are performed by system: Step 1: Create C Program User creates a program to perform specific task. Program has set of instruction. User writes set of instructions in C Editor. This Program is also known as source program or source code. User store/save a program as file name .C in specific location. Step 2: Compiling C Program After creation of C Program compiler checks any error is occurred or not. If any error is occurred then it will display all errors in one message box. If any error is not occurred, compiler converts source program into object file which is in 0 or 1 form (Machine Code) After Compilation, linker linked object file with system library and converts object file into executable file. Step 3: Execution of C Program Loader loads executable file from hard-disk to RAM. Finally Processor execute C Program from RAM.        DEFINITION OF COMPILER, LINKER, LOADER, ASSEMB...

TYPES OF COMPUTER PROGRAMMING LANGUAGE

Image
  TYPES OF COMPUTER PROGRAMMING LANGUAGE: 1.       Machine Language 2.       High Level Language 3.       Assembly Language 4.       Low Level Language 1.Machine Language: A language which can be understandable by machine only is called machine language. This language is in BINARY format – 0 & 1. This language can’t be understandable by human. 2.   High Level Language: It is a formal language in which programmer can write instructions to perform specific task. Ex. C, C++, JAVA etc… programming language are high level language. High level languages are easily understandable by programmer. If we execute our program high level language must be converted into machine language. 3.     Assembly Language: It is a programming language which includes symbols like… ADD, SUB, MUL, DIV etc… for arithmetic operations, binary numbers, memory address or regi...

OVERVIEW OF C PROGRAMMING

Image
   OVERVIEW OF C PROGRAMMING Concept/Definition of Instruction, Program, Programming, Programming Language, Programmer: Instruction: Instruction is a command or request. Program: Program is a set of instruction to perform specific task.     Problem/Program Definition -> Analysis -> Perform -> Check/Compilation -> Execute Programming:  Programming is a process of writing a program. Programming    Process includes Problem analysis, Logic development. Programming Language:  A formal language in which programmer writes/develops a program is called programming language. Ex. C, C++, JAVA, PHP, Python etc. Each programming language has its own syntax.  Programming language can be understandable by user/programmer.  It’s provides a platform/environment in which user can perform different task. Programmer: Programmer is a person who has ability to create a program.  Program has two categories:     ...