Program kończy się zanim wprowadzę odpowiedzi na pytania

0
#include <stdio.h>
#include <string.h>

int main()
{
    char name[20], gender;
    float a, b, c, score;

    printf("\t\tA little quiz\n");
    printf("Enter your name, then enter your gender (m/f)\n");
    scanf(" %s", name);
    scanf(" %c", &gender);

    if(gender == 'm'){
        printf("Good, now answer some questions, dude.\n\n");
    }else{
        printf("Good, now answer some questions, girl.\n\n");
    }

    printf("Question number 1: what is 9+9?\n");
    scanf(" %f", a);
    printf("Question number 2: what is 10*12?\n");
    scanf(" %f", b);
    printf("Question number 3: what is 9^2?\n");
    scanf(" %f", c);

    return 0;
}

Mogę wpisać imię oraz płeć, później gdy wpisuję odpowiedź na pierwsze pytanie program się zawiesza albo wyświetla pozostałe pytania na raz i kończy się

1

Do scanf trzeba podawać adresy. Np. &a zamiast a

0

Oo, no tak, dziękuję

1 użytkowników online, w tym zalogowanych: 0, gości: 1