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
What is pointers in c with example?
What's the difference between constant char *p and char * constant p?
Is there anything like an ifdef for typedefs?
How can I invoke another program (a standalone executable, or an operating system command) from within a c program?
What is main return c?
What does c mean?
How can I delete a file?
What is the use of sizeof () in c?
What does dm mean sexually?
How do I copy files?
How macro execution is faster than function ?
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.
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
What is #include stdio h?
What does c mean in standard form?