Posts

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...

Decision Making Statements in C Programming Language

Image
  Decision Making Statements in C Programming Language Decision making statement are use to take decision from condition. There are different decision making statement: If Statements Conditional Operator ? : Switch Case Statements Goto Statements 1). If Statements: If Statement is a conditional statements. It is use to take any decision. To take any decision, we apply one or more conditions. These conditions can be true or false. Example:               Student is pass or fail:               if (marks>=35)               {                         pass               }               {                              fail    ...

Input-Output Function in C Programming Language

  Input-Output Function in C Programming Language System defined/Built-in Function: A Function which is already defined by system not by user is called system defined functions. C Introduce different system defined functions like - Input-Output functions, Mathematical functions, String functions, Console related functions etc... Source code/Definition code of system defined function are in header file.   INPUT-OUTPUT FUNCTIONS: A function which is use to take input from user and display output or massage on console screen is known as input-output functions. Input Function: scanf(): scanf() is input function which is use to take input from user. getchar(): getchar() is a input function which is use to take single character from user. gets(): gets() is a in-built function which is use to take string from user. getc(): getc() is a input function which is use to take single character from user. Output Function: printf(): It is use to display message or value on console screen...

Operators in C Program

Image
  Operator in C Programming Language Operators is one of the TOKEN which is use to perform specific operations on different values/operands. Like arithmetic, relational, assignment etc... C Program support eight (8) operators: Arithmetic Operator Assignment Operator Relational Operator Conditional Operator Increment and Decrement Operator Logical Operator Bitwise Operator Special Symbol Operator 1. Arithmetic Operator:     Arithmetic operators are used to perform arithmetic operations like... +, -, *, /, % . Real Arithmetic: when we perform arithmetic operations on real numbers, answer will be in real number. Example: 12.5/6.5 =  1.9230 Mix Mode Arithmetic: When we perform arithmetic operations on those numbers in which some numbers are integer and some are real then answer will be floating number. Example: 12+3.5 = 15.5 2. Relational Operators: When we want to compare two operands or values, we use relational operators. Relational operator represent relation between...

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:...