0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【AtCoder】islower関数, isupper関数の注意点

Posted at

islower(), isupper() の戻り値はint型である(bool型ではないので注意)

int main() {
  cout << isupper('A') << endl; // -> 256
  
  // isupper を問題なく使えるケース
  if (isupper('A')) cout << "true" << endl; // -> true
  else cout << "false" << endl;
  
  // isupper を使うと想定外の挙動をするケース
  if (isupper('A') == true) cout << "true" << endl; // -> false
  else cout << "false" << endl;
}

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?