...

View Full Version : segmentation fault



chrismiceli
01-09-2003, 12:52 AM
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-09-2003, 12:59 AM
maybe cauz you forgot the ampersand round i in scanf. Might be the reason.

chrismiceli
01-09-2003, 05: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