Thread: "EXC_BAD_ACCESS" problem

  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)

    "EXC_BAD_ACCESS" problem-screenshot2012-02-03at53748pm-png

    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
    4,633
    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, 04:23 PM
  2. Replies: 2
    Last Post: 03-13-2008, 11:34 AM
  3. Problem with in, "cout" (Each "endl"
    By andreas_nordman in forum C++ Programming
    Replies: 1
    Last Post: 05-30-2004, 07: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