Hi!
Following code convert ascii desimal data to desimal data
result is: datax->65535
-----------------------------------------
result is: datax->0
Because datax is unsigned short int and an overflow occurs.
Is there any method to detect whether an overflow occurs or not?
Thanks in advice...
Following code convert ascii desimal data to desimal data
Code:
char ascii_array[10]="65535";
unsigned short int datax;
sscanf(ascii_array,"%u",&datax);
-----------------------------------------
Code:
char ascii_array[10]="65536";
unsigned short int datax;
sscanf(ascii_array,"%u",&datax);
Because datax is unsigned short int and an overflow occurs.
Is there any method to detect whether an overflow occurs or not?
Thanks in advice...