Segmentation Fault

This is a discussion on Segmentation Fault within the C Programming forums, part of the General Programming Boards category; alright how is this possible i'm getting a Segmentation Fault when running this code Code: #include <stdio.h> int main(){ int ...

  1. #1
    Registered User
    Join Date
    Oct 2010
    Posts
    2

    Segmentation Fault

    alright how is this possible

    i'm getting a Segmentation Fault when running this code

    Code:
    #include <stdio.h>
    
    int main(){
         int x;
         printf("Please enter an odd number 1-99: ");
         scanf("%d",x);
    }
    am i doing something stupid? i'm running OpenSUSE 11.3 complier gcc

  2. #2
    Registered User
    Join Date
    Oct 2010
    Posts
    2
    nevermind i figured it out. i was doing something retarded lol

    Code:
    scanf("%d",&x)
    !!

    *slaps forehead*

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. segmentation fault... first time with unix...
    By theMethod in forum C Programming
    Replies: 16
    Last Post: 09-30-2008, 02:01 AM
  2. Segmentation fault
    By bennyandthejets in forum C++ Programming
    Replies: 7
    Last Post: 09-07-2005, 05:04 PM
  3. Segmentation fault
    By NoUse in forum C Programming
    Replies: 4
    Last Post: 03-26-2005, 02:29 PM
  4. Locating A Segmentation Fault
    By Stack Overflow in forum C Programming
    Replies: 12
    Last Post: 12-14-2004, 12:33 PM
  5. Segmentation fault...
    By alvifarooq in forum C++ Programming
    Replies: 14
    Last Post: 09-26-2004, 12:53 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21