Untitled

mail@pastecode.io avatar
unknown
plain_text
10 days ago
350 B
2
Indexable
Never
#include <stdio.h>
#include <stdbool.h>

// Define a struct
struct being {
    bool alive;
};

void kill(struct being *b) {
    if (!b->alive) {
        printf("Killing self...\n");
    }
}

int main() {
    struct being is_alive = { true }; //instance
    
    //kill func
    kill(&my_being); //you can also move the alive boolean outside it
    
}
Leave a Comment