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 is type qualifiers?
Can U write a C-program to print the size of a data type without using the sizeof() operator? Explain how it works inside ?
without using arithmatic operator convert an intger variable x into x+1
What is %d used for?
A.C func() { pritnf(" in fuction %d",MACRO); } MAIN.c testfunc() { #define MACRO 10 printf("in test function %d", MACRO); } main() { printf("in main %d",MACRO); func(); testfunc(); getch(); }
Is the following code legal? struct a { int x; struct a b; }
How are structure passing and returning implemented?
What is #pragma directive?how it is used in the program? what is its advantages and disadvantages?
What does struct node * mean?
Should I learn c before c++?
How many types of functions are there in c?
i want to make a program in which we use input having four digits(4321) and get output its reciprocal(1234).