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
Why & is used in scanf in c?
What language is lisp written in?
How can my program discover the complete pathname to the executable from which it was invoked?
What is scope and lifetime of a variable in c?
What is meant by operator precedence?
Can you please explain the scope of static variables?
List some applications of c programming language?
Explain what are header files and explain what are its uses in c programming?
Tell us something about keyword 'auto'.
What is sizeof int?
What is sizeof return in c?
What is integer constants?
What is ## preprocessor operator in c?
Can you define which header file to include at compile time?
Explain what are the __date__ and __time__ preprocessor commands?