segmentation fault
Alright so I need a program to run for a class, and I am using Ubuntu 9.04 default installation with GCC 4.33 and I am trying to compile a program, it is as follows:
#include <stdio.h>
#define PI 3.1415926535898
int main() {
FILE *ifp;
int numcases;
int day;
int mph, time;
double radius;
double area;
ifp = fopen("jetski.in", "r");
fscanf(ifp, "%d", &numcases);
for (day=1; day<=numcases; day++) {
radius = mph*time/60.0;
area = .5*PI*radius*
printf("Day %d: %.2lf\n", day, area);
}
fclose(ifp);
return 0;
}
Really simple program that takes in values and gives out some, but after compiling it with "gcc test.c" it gives me a file a.out and when I do "./a.out" it gives me error saying segmentation fault, even when I try "sudo su" One more question is there any program that can convert the code in c and c++ to be used in Linux. I have more than 4000 lines of coding in adaboost project that I need to be able to use in linux so please help. I don't use MATLAB because it is slower so please please help me out here... I am kind of stuck
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- Ubuntu Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Vikram Dhillon
- Solved:
- Last query:
- Last reply: