C program to show the use of ‘char’ data type.
Q2. Write a C program to show the use of ‘char’ data type.
Solution:
#include<stdio.h> //standard input/output header file
#include<conio.h> //for clrscr()
int main()
{ char mychar1,mychar2;
clrscr(); //to clear the screen
mychar1=’A’;
mychar2=’B’;
printf(“\n Mychar1=%c”,mychar1);
printf(“\n Mychar2=%c”,mychar2);
getch(); //holds the screen until a key is pressed
return 0;//makes the main() to finish
}
OUTPUT:
Mychar1=A
Mychar2=B