I am just learning C and I am trying to write a simple program to do a simple calculation. The program compiles just fine, however when I enter values and attempt to run it, I get "Segmentation Fault". Can someone please help me understand why this is happening and what exactly a segmentation fault is?
Code:
#include <stdio.h>
float main()
{
int price, service;
float annual, value;
printf("Enter the purchase price, years of service, annual depreciation:\n");
scanf("%d %d %f\n", price, service, annual);
value = (annual * service) - price;
printf("The salvage value of the item is %f", value);
return 0;
}
Any and all help is greatly appreciated! Thanks!