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
Can stdout be forced to print somewhere other than the screen?
Distinguish between actual and formal arguments.
What is meant by errors and debugging?
main() { printf("hello"); fork(); }
What is the right type to use for boolean values in c? Is there a standard type? Should I use #defines or enums for the true and false values?
Subtract Two Number Without Using Subtraction Operator
Can you mix old-style and new-style function syntax?
Explain about C function prototype?
Why shouldn’t I start variable names with underscores?
What is identifiers in c with examples?
Can I initialize unions?
can anyone please tell about the nested interrupts?
Describe explain how arrays can be passed to a user defined function
How to write a code for reverse of string without using string functions?
What are the basic data types associated with c?