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
WRITE A PROGRAM TO MERGE TWO SORTED ARRAY USING MERGE SORT TECHNIQUE..
How are pointers declared in c?
Why can’t constant values be used to define an array’s initial size?
Are the variables argc and argv are always local to main?
Can a function argument have default value?
What is the size of enum in bytes?
What is an identifier?
Give differences between - new and malloc() , delete and free() ?
Are pointers integer?
What does it mean when a pointer is used in an if statement?
How can I write data files which can be read on other machines with different word size, byte order, or floating point formats?
What is function what are the types of function?
what value is returned to operating system after program execution?
Why flag is used in c?
Tell me when would you use a pointer to a function?