...

View Full Version : segmentation fault



chrismiceli
01-08-2003, 11:52 PM
how come i get segmentation faults on this code


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

float bonus(void);

void main() {
float b;
printf("Enter a # to be incremented: ");
b=bonus();
printf("The incremented is now %.2f",b);
}
float bonus(void) {
float i;
scanf("%f",i);
return(i+1);
}

Josh Campbell
01-08-2003, 11:59 PM
maybe cauz you forgot the ampersand round i in scanf. Might be the reason.

chrismiceli
01-09-2003, 04:21 AM
i owe you my life :) i am stupid, but i will take you on in javascript, mabey :D



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum