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...

How to find the digits truncation when assigning the
interger variable to the character variables.

like int i=500; char x = i : here we have truncation. how to
find this.

another ex: i =100; char x=i. here we do not have
truncation.

Answer Posted / ashu

when i=500 in int which means it is not going beyond the limit of integer range in memory but when x=i which means we are assigning value of i to x.. that is now x becomes 500 whose data type is "char" and range is only -128 to 127 in signed & 0 to 255 in unsigned.. i.e. it is crossing the range.. there we find truncation here

where as in 2nd ex: i=100 which then x=i in char datatype that is char x variable is assigned with i=100 which is not byond range of char data type..therefor no truncation in this example we can find.

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is pointers in c with example?

1022


What's the difference between constant char *p and char * constant p?

1089


Is there anything like an ifdef for typedefs?

1094


How can I invoke another program (a standalone executable, or an operating system command) from within a c program?

1130


What is main return c?

934


What does c mean?

974


How can I delete a file?

1015


What is the use of sizeof () in c?

992


What does dm mean sexually?

1261


How do I copy files?

1000


How macro execution is faster than function ?

1131


Want to know how to write a C program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the total number of disk writes by MySQL.

1985


what is the c source code for the below output? 5555555555 4444 4444 333 333 22 22 1 1 22 22 333 333 4444 4444 5555555555

3003


What is #include stdio h?

1060


What does c mean in standard form?

1101