I'm writing a program where we have to just ask the user for a movie title, adult tickets sold, and child tickets sold and then it displays calculated information based on what was entered. I'm getting a Segmentation fault (core dumped) error very early into the program. I'm wondering why I'm getting it and how to resolve?
Here is the beginning of the program. I get the error after entering a value for the number of adult tickets sold. I am able to input the movie name without error. I've read the error is because I am trying to reference something I don't have access to. I guess I'm just confused on the syntax and maybe if I am even declaring the variables correctly or referencing them properly in the scanf statements.
#include <stdio.h>
#include <string.h>
int main()
{
//Defines constant variables
const double adultPrice = 10, childPrice = 6;
const double profitMargin = .2;
//Defines variables for the number of tickets sold
double adultTix, childTix, gross, adultGross, childGross, net, paidToDist;
//Defines variable to hold name of movie
char movieName[50];
//Asks user for name of movie
printf("Please enter the movie name: ");
scanf("%s", movieName);
//Asks user for # of adult tickets sold
printf("Please enter the number of adult tickets sold: ");
scanf("%f", adultTix);
//Asks user for # of child tickets sold
printf("Please enter the number of child tickets sold: ");
scanf("%f", childTix);
}