알고리즘 29 - Convert a Boolean to a String

944 단어 CodewarsalgorithmCC

Q.

Implement a function which convert the given boolean value into its string representation.

Note: Only valid inputs will be given.

A)

#include <stdbool.h>

const char *boolean_to_string(bool b) {
  return b ? "true" : "false";
}

좋은 웹페이지 즐겨찾기