Just declare a char
variable and assign the value. To assign hex prefix with 0x
, for octal use 0
and for decimal just write the number with no prefix.
The decimal ascii value of 'z'
is 122.
#include <stdio.h>
int main() {
char a = 122;
char b = 0x7a;
char c = 0172;
char d = 'z';
putchar(a);
putchar(b);
putchar(c);
putchar(d);
}
All these char
variables have the same value so four z
s will be printed.
solved I am finding difficulties to solve an expression [closed]