fork download
  1. #include <iostream>
  2. #include <stdlib.h>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7. const char* s = "-4";
  8. unsigned value = -1;
  9. cout << "value before:" << value << endl;
  10. int res = sscanf(s, "%u", &value);
  11. cout << "value after:" << value << endl;
  12. cout << "res:" << res << endl;
  13. return 0;
  14. }
Success #stdin #stdout 0s 16064KB
stdin
Standard input is empty
stdout
value before:4294967295
value after:4294967292
res:1