Write a c program to demonstrate Type casting in c?
Answer Posted / shivakumar
#include <stdio.h>
int main()
{
for ( int x = 0; x < 256; x++ ) {
/* Note the use of the int version of x to output a
number and the use
* of (char) to typecast the x into a character
which outputs the
* ASCII character that corresponds to the current
number
*/
printf( "%d = %c\n", x, (char)x );
}
getchar();
}
Is This Answer Correct ? | 11 Yes | 2 No |
Post New Answer View All Answers
Explain what math functions are available for integers? For floating point?
Write the control statements in C language
Tell us bitwise shift operators?
When can a far pointer be used?
Differentiate between the expression “++a” and “a++”?
Which is the best website to learn c programming?
What’s the special use of UNIONS?
What the different types of arrays in c?
What is the use of volatile?
main() { int i = 10; printf(" %d %d %d ", ++i, i++, ++i); }
Is main a keyword in c?
Why do we need functions in c?
If fflush wont work, what can I use to flush input?
Where in memory are my variables stored?
What is the difference between NULL and NUL?