Untitled

 avatar
unknown
plain_text
a year ago
350 B
4
Indexable
#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
    
}
Editor is loading...
Leave a Comment