Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8972991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:20:58+00:00 2026-06-15T18:20:58+00:00

The code below is crashing with EXC_BAD_ACCESS. Anyone have any clues as to why?

  • 0

The code below is crashing with EXC_BAD_ACCESS. Anyone have any clues as to why?

The following warnings are reported:

Incompatible integer to pointer conversion assigning to ‘char *’ from ‘int’

register int t;
char *s;
double val;

s = printn(val);
t = strlen(s); // <<< breaks on this line

...

char *printn(n)
double n;
{
    register char *fmt, *s, *ss;
    double absn;
    short sign;

    ....
    s = printb("%-0.2f", sign*absn);
    for (ss = s; *ss; ++ss);
    while (*--ss == '0' || *ss == ' ') *ss = 0;
    if (*ss == '.') *ss = 0;

    return(s);
}

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T18:20:59+00:00Added an answer on June 15, 2026 at 6:20 pm
    char *s;
    double val;
    
    s = printn(val);
    

    At this point, no declaration of printn is in scope. So the compiler, using the old C89 rules, assumes an implcit declaration of printn returning an int.

    Declare all functions before you use them.

    char *printn(double n);
    char *s;
    double val;
    // ..
    s = printn(val);
    

    That would work.

    char *printn(n)
    double n;
    {
    

    Please use the modern syntax,

    char * printn(double n)
    {
        // implementation
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

my app crashes with a null pointer exception on the code below. i have
I have the following code below to populate an array with images: NSString *fileName;
Code below is working well as long as I have class ClassSameAssembly in same
The code below simply didn't work. document.getElementById('files').addEventListener('change', handleFileSelect, false); reported by firebug that this
My code below gave a different length for the unsigned char pointer I expect.
I am having some problems with an app that keeps crashing intermittently. Code below
I have a code snippet below from an exercise I'm working on. It reads
hi i have the below code tryinh to get the image data but sometimes
Below is my Code crashing on CTFramesetterRef framesetter = CTFramesetterCreateWithAttributedString(currentText); I am trying to
When running the below code, the [dict setValue:@null forKey:@name]; keeps crashing. I search on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.