Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!

Idiom #126 Multiple return values

Write a function foo that returns a string and a boolean value.

#include <stdbool.h>
typedef struct {
    const char * const a;
    const bool b;
} RetStringBool;

RetStringBool foo() {
    return (RetStringBool) {.a = "Hello", .b = true};
}

New implementation...
< >
MLKo