I do not identify the error - | 35 | error: 'd' undeclared (first use in this function) |

0

I'm programming in C / C ++ and gave an error that I can not identify it.

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

//Função Principal do Programa
 int main() {

      //Definindo variáveis
      int a = 5, b = 10, c = 15;

      //Maior
      if(a > 2){
         printf("\n %d Eh maior que 2\n", a);
      }

      //Maior ou Igual
      if(c >= b){
        printf("\n %d Eh maior ou igual a %d\n", c, b);
      }

      //Menor
      if(a < 10){
        printf("\n %d Eh menor que 10\n", a);
      }

     //Menor ou Igual
     if(a <= 10){
        printf("\n %d eh menor ou igual a 10\n", a);
     }

     //Diferente
      if(c != 10){
         printf("\n %d nao eh 10\n", c);
     }
      if(d != 'a'){
            printf("\n %c nao eh a", d);
     }

     //Pausa o Programa após executar
     system("pause");

}
    
asked by anonymous 10.07.2018 / 23:40

1 answer

3

As the message itself already indicates, the variable d is missing. It is using it in the last if without it existing. One solution would be:

int a = 5, b = 10, c = 15
char d = 'a';
    
10.07.2018 / 23:43