What's wrong with this code?
I'm new to C and I decided to try and make a quick program after learning the basics, but it doesn't seem to be working. I want it to display the car model when it receives the year the user asks for.
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
struct Car
{
char brand[45];
char model[45];
int year;
};
int main(){
struct Car car1={"BMW", "X5", 1999};
struct Car car2={"Ford", "Mustang", 1969};
struct Car car3={"Toyota", "Corolla", 2011};
int carYear;
printf("Which year would you like to know the car model of? ");
scanf("%d", carYear);
if (carYear == car1.year){
printf("The model is %s", car1.model);
} else if (carYear == car2.year){
printf("The model is %s", car2.model);
} else if (carYear == car3.year){
printf("The model is %s", car3.model);
} else {
printf("Not found in database.");
}
}