Introduction Data type Variable-Constant Keyword-Identifier Operations Input&Output If-else Switch loops String Array Functions Recursion-Function Mat-Function Pointers File handling Read & write Error handling Read & write error handling


Data Types

Datatype defined as the what type of data store in program , like int char etc.


Data Type Format Specifier Description
int %d integer in decimal.
float %f Float.
char %c Character.
string %s String.
Boolean (Using integers) %d Use with integers (0 for false, 1 for true) to print boolean values.

Example
                    
#include <stdio.h>
// importing booling in header 
 #include <stdbool.h> 

 main() {
    /* initializing & declaring data types with values.*/
  int age = 42;
  float percentage = 3.14;
  double  bigper= 123.456789;
  char grade = 'A';
  bool boolVar = true; // 1 represents true
         
  printf("Age in integer: %d\n", age);
  printf("Percentage in float: %.2f\n", percentage);
  printf("Bigpercentage in double: %lf\n", bigper);
  printf("Grade incharacter: %c\n", grade);
  printf("Boolean value in bool : %d\n", boolVar);   
       }   
OutPut
  Age in integer: 42
  Percentage in float: 3.14
  Bigpercentage in double: 123.456789
  Grade incharacter: A
  Boolean value in bool : 1
                    
Click to Open Popup Box !





@2022, Padma Education.

We cannot warrant full correctness of all content, we try to give our best. While using Padma education website, you agree to have read and accepted our terms and Conditions , privacy policy.