Use of Character in C Language;

 Q:1 What is Character ?

ans:    Character is an alphabet or symbol also like 'a','A','$','#' and '0','9'.

Q: How C Language deals with characters.

Ans: C Language deals with characters in the form of                           ASCII(American Standard code for Information Interchange) values.

Q:What are the ASCII values of 'a','A','0' etc?

Ans: ASCII value of 'a' =97, 'A' =65 and 0 = 48 and difference between them is of 32.

Q: How we can store a character in C Program?

Ans: char ch='a';

Program to use Character in C.

#include<stdio.h>

int main()

{

    char ch='a';

    int i;

    printf("\n value of ch is %c",ch);

    printf("\n The ASCII value of a is %d",ch);

    ch=ch-32;//putting ASCII value of A

    printf("\n Now the value of ch is %c ",ch);

    printf("\n ASCII value of A is %d",ch);

    ch='0';

   // printf("\n ASCII value of 0 is %d",ch);

   printf("\n\nASCII values of Numbers from : 0:10");


    for(i=0;i<=9;i++)

    {

        printf("\n ASCII value of %c = %d",ch,ch);

    ch++;

    }


}//end of main




Comments