mercredi 3 mai 2017

Why is this If statement not executing the code I've checked all syntax please help me

#include <stdlib.h>
#include <stdio.h>

int main(){
  char * response;
  int anger = 0;
  int correct = 0;
  printf("type Dice");
  scanf("%s", response);
  if (response == "Dice"){
    printf("Good Job!");
    correct = 1;
  }
}

I an trying to make a response generator and the is statement isn't working I tried setting the variable response to the correct answer and the if statement worked so I was thinking that maybe something was wrong with my scanf please help i'm a beginner in C

Aucun commentaire:

Enregistrer un commentaire