Does arithmetic operation on the value of type char - C Data Type

C examples for Data Type:char

Introduction

Here's an example of an arithmetic operation with a value of type char:

Demo Code

#include <stdio.h> 
  
int main(void) 
{ 
    char letter = 'C';                          // letter contains the decimal code value 67
    /*ww w.j  av a  2s  .c om*/
    printf("The character is %c\n", letter);
    
    letter = letter + 3;                        // letter now contains 70, which is 'F'

    printf("The character is %c\n", letter);
    return 0; 
}

Result


Related Tutorials