dimanche 24 janvier 2021

Why is the ternary operator returning 0?

Why does the following code have '0' as output?

#include <bits/stdc++.h>

int main() {
    int max = 5;
    std::cout << (false) ? "impossible" : std::to_string(max);
}

Aucun commentaire:

Enregistrer un commentaire