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 / 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 |
Why do we use static in c?
accept character from keyboard untill the user presses the enter key.If the user enters any character other than upper case(A-Z)alphabets program should stop taking any input
any limit on the number of functions that might be present in a C program a) max 35 functions b) max 50 functions c) no limit d) none of the above
Concat two string with most overlapped substring has to removeĀ "abcd"+ "cdef" = "abcdef
what is the difference between NULL & NUL keywords in C?
Write a program to generate prime factors of a given integer?
main() { int x=5; printf("%d %d %d\n",x,x<<2,x>>2); } what is the output?
what is the difference between postfix and prefix unary increment operators?
What is Heap?
hai iam working in sap sd module for one year and working in lumax ind ltd in desp department but my problem is i have done m.b.a in hr/marketing and working sap sd there is any combination it. can you give right solution of my problem. and what can i do?
in programming languages a statement or part of a statement that specifies several different execution sequences a) constructs b) distructs c) executes d) none
Write a program to produce the following output: 1 2 3 4 5 6 7 8 9 10