—————————————-
char data type in c programming
size -> 1 byte(8 bit)
range -> -128 to 127
format -> %d , %c , %x , %o
—————————————-
Fundamental-level questions.
1.
#include<stdio.h>
int main()
{
char ch = ‘A’;
printf(“%c\n”,ch);
}
2.
#include<stdio.h>
int main()
{
char ch = ‘B’;
printf(“%d\n”,ch);
}
3.
#include<stdio.h>
int main()
{
char ch = ‘C’;
printf(“%x\n”,ch);
}
4.
#include<stdio.h>
int main()
{
char ch = ‘D’;
printf(“%o\n”,ch);
}
5.
#include<stdio.h>
int main()
{
char ch = 100;
printf(“%c\n”,ch);
}
6.
#include<stdio.h>
int main()
{
char ch = 97;
printf(“%d\n”,ch);
}
7.
#include<stdio.h>
int main()
{
char ch = 50;
printf(“%c\n”,ch);
}
8.
#include<stdio.h>
int main()
{
char ch = 52;
printf(“%o\n”,ch);
}
9.
#include<stdio.h>
int main()
{
char ch = ‘a’;
printf(“%o\n”,ch);
}
10.
#include<stdio.h>
int main()
{
char ch = ‘0’;
printf(“%d\n”,ch);
}
11.
#include<stdio.h>
int main()
{
char ch = ‘2’;
printf(“%d\n”,ch);
}
Answer of above 11 c questions
1. A
2. 66
3. 43
4. 104
5. d
6. 97
7. 2
8. 64
9. 141
10.48
11.50