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 |
main() { printf(5+"good morning"); printf("%c","abcdefgh"[4]); }the o/p is morning and e...how someone explain
pick out the odd one out of the following a.malloc() b.calloc() c.free() d.realloc()
I need previous papers of CSC.......plz help out by posting them.......
What is void main ()?
What's wrong with "char *p = malloc(10);" ?
What is the use of extern in c?
How do you determine if a string is a palindrome?
#include<stdio.h> main() { int a[3]; int *I; a[0]=100;a[1]=200;a[2]=300; I=a; Printf(“%d\n”, ++*I); Printf(“%d\n”, *++I); Printf(“%d\n”, (*I)--); Printf(“%d\n”, *I); } what is the o/p a. 101,200,200,199 b. 200,201,201,100 c. 101,200,199,199 d. 200,300
when will be evaluated as true/ if(x==x==x) a) x=1; b) x=0; c) x=-1; d) none
What is the difference between exit() and _exit()?
given the piece of code int a[50]; int *pa; pa=a; to access the 6th element of the array which of the following is incorrect? a.*(a+5) b.a[5] c.pa[5] d.*(*pa + 5)
What is break statement?