"EXC_BAD_ACCESS" problem

This is a discussion on "EXC_BAD_ACCESS" problem within the C Programming forums, part of the General Programming Boards category; Hi guys! So I'm trying to run this program but I keep getting this error on the first statement and ...

  1. #1
    Registered User hawkeye10's Avatar
    Join Date
    Feb 2012
    Posts
    3

    "EXC_BAD_ACCESS" problem

    Hi guys! So I'm trying to run this program but I keep getting this error on the first statement and I just can't understand it. (sorry still a novice programmer)

    Name:  ScreenShot2012-02-03at53748PM.png
Views: 157
Size:  40.1 KB

    here's what it says on my output.
    Code:
    Would you like to take your BMI using Meters and Kilograms: y
    Current language:  auto; currently minimal
    (gdb) 
    I would really appreciate the help guys!

  2. #2
    Registered User
    Join Date
    May 2010
    Posts
    2,895
    You need to pass the address of the variable in your scanf() call. Look at your other scanf() calls for hints.

    Jim

  3. #3
    Registered User
    Join Date
    Dec 2011
    Posts
    795
    Also, it's good practice to copy/paste your code, and not paste a screenshot. EXC_BAD_ACCESS is just Xcode's way of informing you that a SIGSEGV was raised during your program's execution, usually when memory is being accessed illegally. In this case, Jim is correct, you are not passing the pointer, so scanf is trying to write to the wrong memory, raising the signal.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 03-31-2009, 05:23 PM
  2. Replies: 2
    Last Post: 03-13-2008, 12:34 PM
  3. Problem with in, "cout" (Each "endl"
    By andreas_nordman in forum C++ Programming
    Replies: 1
    Last Post: 05-30-2004, 08:25 AM
  4. "itoa"-"_itoa" , "inp"-"_inp", Why some functions have "
    By L.O.K. in forum Windows Programming
    Replies: 5
    Last Post: 12-08-2002, 08:25 AM
  5. "CWnd"-"HWnd","CBitmap"-"HBitmap"...., What is mean by "
    By L.O.K. in forum Windows Programming
    Replies: 2
    Last Post: 12-04-2002, 07:59 AM

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