Char datatype in C-language

Total Post:57

Points:285
C#  Variable 
C#
 481  View(s)
Ratings:
Rate this:
  1. Post:57

    Points:285
    Char datatype in C-language

    Char datatype in c language:

    The memory allocated to a character variable is 1 byte while memory allocated to character constant is 4 byte because it returns ASCII value. 

    #include<stdio.h> 
    int main() {
      char s='a';
      printf("%d",(int)sizeof(s));
      printf("%d",(int)sizeof('a'));
      return 0;
    }
    char ch1 = 'a'; 
    char ch2 = ch1;

Answer