Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How do I fix this life function code?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 221
    Answer it

    Please help me to fix the life function code. 

    #include <stdio.h>
    
    #include <stdbool.h> //I learned that you need to add stdbool.h to make the bool function work - Chris
    
    
    
    int main(void) {
    
    printf("You will have life functions. You will get 3 lifes.\n");
    
    char life [3];
    
    int aa;
    
    printf("You have 3 lifes");
    
    printf("Press 'S' to start");
    
    scanf("%i",&aa);
    
    
    
    bool PlayerDied( PlayerData * pd )
    
    {
    
    bool alive = false;
    
    --pd->Lives; // player died - one less life
    
    return pd->Lives <= 0;
    
    alive = true; // player still has a life left
    
    return alive;
    
    }
    
    return 0;
    
    }

     

 0 Answer(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: