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

 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 that holds large real number with fractional part.
      • It requires 8 bytes.
      • We can give 15 numbers/digits after fractional part.
      • Ex. double d=10.55;  O/T d=10.550000 
      • We have long double datatype that holds large real number.
      • It requires 10 bytes.
      • Ex. long double d=10.55;
  • DERIVED DATATYPE:
    • A datatype which is created from primary data type is known as derived datatype.
    • Example:
      • Array
      • Structure
      • Union
      • Pointer
  • USER DEFINED DATATYPE:
    • A datatype which is created by user according to needs of user.
    • To create user defined datatype we use enum and typedef keywords.



Comments

Popular posts from this blog

Different Modules to solve the program/problem

Operators in C Program