Advertisement
Guest User

Untitled

a guest
Sep 6th, 2013
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. void g(char c, signed char sc, unsigned char uc)
  2. {
  3. c = 255; //implementation-defined if plain chars are signed and have 8 bits
  4. c = sc; //OK
  5. c = uc; //implementation-defined if plain chars are signed and if uc's value is too large
  6. sc = uc; //implementation-defined if uc's value is too large
  7. uc = sc; //OK: conversion to unsigned
  8. sc = c; //implementation-defined if plain chars are unsigned and if c's value is too large
  9. uc = c; //OK: conversion to unsigned
  10. }
  11.  
  12. signed char sc = -160;
  13. unsigned char uc = sc; //uc == 116 (because 256-160==116)
  14. cout << uc; //print 't'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement