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.



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

Answer / 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

More C Interview Questions

What's the difference between calloc() and malloc()?

4 Answers  


There is a number and when the last digit is moved to its first position the resultant number will be 50% higher than the original number.Find the number?

1 Answers  


write a recursive program in'c'to find whether a given five digit number is a palindrome or not

2 Answers  


What is huge pointer in c?

0 Answers  


Program to write some contents into a file using file operations with proper error messages.

2 Answers  






what is the use of ~ in c lang?????

3 Answers  


The variables are int sum=10,SuM=20; these are same or different?

3 Answers  


‘ C’ PROGRAME TO SHOW THE TYPE OF TRANGLE BY ACCEPTING IT’S LENGTH .

0 Answers  


how to find your architecture is LittleEndian or BigEndian?

1 Answers  


Explain the importance and use of each component of this string: Foo.Bar, Version=2.0.205.0, Culture=neutral, PublicKeyToken=593777ae2d274679d

1 Answers   TCS,


how we can make 3d venturing graphics on outer interface

1 Answers   Microsoft,


C program to find all possible outcomes of a dice?

0 Answers  


Categories