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

Why & is used in scanf in c?

1054


What language is lisp written in?

1183


How can my program discover the complete pathname to the executable from which it was invoked?

1039


What is scope and lifetime of a variable in c?

998


What is meant by operator precedence?

1098


Can you please explain the scope of static variables?

1004


List some applications of c programming language?

913


Explain what are header files and explain what are its uses in c programming?

1119


Tell us something about keyword 'auto'.

1016


What is sizeof int?

1055


What is sizeof return in c?

997


What is integer constants?

1024


What is ## preprocessor operator in c?

1033


Can you define which header file to include at compile time?

988


Explain what are the __date__ and __time__ preprocessor commands?

1081