Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


Write a c program to demonstrate Type casting in c?

Answers were Sorted based on User's Feedback



Write a c program to demonstrate Type casting in c?..

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

Write a c program to demonstrate Type casting in c?..

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

Post New Answer

More C Interview Questions

if a is an integer variable, a=5/2; will return a value a) 2.5 b) 3 c) 2 d) 0

0 Answers  


What are header files? What are their uses?

0 Answers  


Which is better pointer or array?

0 Answers  


Is Exception handling possible in c language?

0 Answers   Wipro,


What is the scope of static variables in c language?

0 Answers  






Write a program to print a (*)pattern programming (A to Z) in capital in one programming ?

2 Answers   TCS,


How do we print only part of a string in c?

0 Answers  


Write a C++ program without using any loop (if, for, while etc) to print numbers from 1 to 100 and 100 to 1;

18 Answers   Accenture, Cisco, Egentec, HCL, Ideaz, Infosys, M-Systems, MYR, TCS,


what is the differnce between AF_INET and PF_INET?

5 Answers   Systems Plus, Wipro,


What is non linear data structure in c?

0 Answers  


What is true about the following C Functions (a) Need not return any value (b) Should always return an integer (c) Should always return a float (d) Should always return more than one value

2 Answers   DynPro, TCS,


code for quick sort?

0 Answers  






Categories