Write a c program to demonstrate Type casting in c?
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / pinkey
#include<stdio.h>
#include<conio.h>
void main()
{
int a=5,b=4,c;
c=short(a+b);
printf("%d",c);
getch();
}
| Is This Answer Correct ? | 7 Yes | 5 No |
What are the valid places to have keyword “break”?
Can you please explain the difference between exit() and _exit() function?
say the following declaration is correct nr not. int b=a,n=0;
How do I create a directory? How do I remove a directory (and its contents)?
how can make variable not in registers
What is static and volatile in c?
What is difference between structure and union?
I have a varargs function which accepts a float parameter?
post new interiew question and aptitude test papers
Explain what are the different file extensions involved when programming in c?
What is the difference b/w main() in C language and main() in C++.
main() { printf("hello"); fork(); }