Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Sep 6th, 2013  |  syntax: None  |  size: 0.59 KB  |  views: 26  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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'
clone this paste RAW Paste Data