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


Constants

This are used to represent fixed values that do not change / modifie during the program's execution time


Example
 
  #include  <stdio.h>

  int main() {
    const int age = 23;
                    
    printf(" Age : %d\n", age);
    return 0;
  }
                

OutPut
Age : 23


Example
  
  #include <stdio.h>

    int main() {
        const int age = 20;
        age = 15; //error we can't change the constant
        printf("%d\n", age);
        return 0;
    }
                

OutPut
age = 15; //error we can't change the constant

Variable

Variables are the data name that we use to store data


Example
 #include <stdio.h>

 int main() {

  // Declares an variables & assigns values.

  int age;  
  float salary;    
  char grade;                    
  age = 30; 
  salary = 5000.5; 
  grade = 'A'; 

  // Printing assigned values .

  printf("Age: %d\n", age);     
  printf("Grade: %c\n", grade);   
  printf("Salary: %.2f\n", salary);  
 return 0;
   }
                    
 

OutPut
           
Age: 30
Grade: A
Salary: 5000.50

Open kannada !





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