Variable Types and Operators in C

  • Post author:
  • Post category:c
  • Post comments:0 Comments

Variable Types and Operators in C

In this lesson, you will learn about the different types of variables and operators used in C programming. Variables are used to store data in memory and they come in different types such as int, float, and char. Operators such as +, -, *, and / are used to manipulate these variables.

Example

Example:
#include <stdio.h> 

int main() 
{ 
    int a = 10; 
    int b = 20; 
    int c; 
  
    c = a + b; 
  
    printf("The sum of %d and %d is %d", a, b, c); 
  
    c = a - b; 
  
    printf("The difference of %d and %d is %d", a, b, c); 
    return 0; 
} 

Output

The sum of 10 and 20 is 30
The difference of 10 and 20 is -10

Leave a Reply