Go Back   CodingForums.com > :: Computing & Sciences > Computer Programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-08-2003, 11:52 PM   PM User | #1
chrismiceli
Regular Coder

 
Join Date: Sep 2002
Location: Louisiana
Posts: 576
Thanks: 0
Thanked 0 Times in 0 Posts
chrismiceli is an unknown quantity at this point
segmentation fault

how come i get segmentation faults on this code
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);
}
__________________
DevEdge - MSDN - DevGuru
chrismiceli is offline   Reply With Quote
Old 01-08-2003, 11:59 PM   PM User | #2
Josh Campbell
New Coder

 
Join Date: Jun 2002
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
Josh Campbell is an unknown quantity at this point
maybe cauz you forgot the ampersand round i in scanf. Might be the reason.
Josh Campbell is offline   Reply With Quote
Old 01-09-2003, 04:21 AM   PM User | #3
chrismiceli
Regular Coder

 
Join Date: Sep 2002
Location: Louisiana
Posts: 576
Thanks: 0
Thanked 0 Times in 0 Posts
chrismiceli is an unknown quantity at this point
i owe you my life i am stupid, but i will take you on in javascript, mabey
__________________
DevEdge - MSDN - DevGuru
chrismiceli is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:52 PM.


Advertisement
Log in to turn off these ads.