Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

Can stdout be forced to print somewhere other than the screen?

1045


Distinguish between actual and formal arguments.

1073


What is meant by errors and debugging?

1099


main() { printf("hello"); fork(); }

1189


What is the right type to use for boolean values in c? Is there a standard type? Should I use #defines or enums for the true and false values?

1050


Subtract Two Number Without Using Subtraction Operator

843


Can you mix old-style and new-style function syntax?

1098


Explain about C function prototype?

1083


Why shouldn’t I start variable names with underscores?

1057


What is identifiers in c with examples?

1169


Can I initialize unions?

1037


can anyone please tell about the nested interrupts?

2112


Describe explain how arrays can be passed to a user defined function

1093


How to write a code for reverse of string without using string functions?

2139


What are the basic data types associated with c?

1268