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 6388999
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:20:58+00:00 2026-05-25T03:20:58+00:00

If I do this: void printfloat(float number) { printf(%f, number); } and void printdouble(double

  • 0

If I do this:

void printfloat(float number)
{
    printf("%f", number);
}

and

void printdouble(double number)
{
    printf("%f", number);
}

What is the maximum number of characters that can be output by each function?

  • 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-05-25T03:20:59+00:00Added an answer on May 25, 2026 at 3:20 am

    Conclusion:

    I was unable to get snprintf to tell me how big the string would be, and I want to keep the code as compiler-independent as possible. So here is the solution I came up with.

    char numstr[50];
    sprintf_s(numstr, "%g", *value);
    m_stringRepresentation += numstr;
    

    %g outputs the number in scientific notation, which severely limits the number of characters. I picked a buffer large enough to contain anything that might output. My only compiler-dependency is on sprintf_s.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this function: void func(boost::function<void(float)> cb){ //do something with cb() } It works
I wrote a function that looks like this: - (void)changeText:(NSUInteger)arrayIndex; Let's just say that's
I have a file with function signatures like this: void something(float a, int b,
I have a function using strtok like this void f1(char *name) { ... char
The code that I want to write is like this: void MethodOnThreadA() { for
Often I see a function declared like this: void Feeder(char *buff, ...) what does
I have a function similar to this: void foo(obj ary[], int arysize) { for
Given that I do something like this: void glOrtho( GLdouble left, GLdouble right, GLdouble
I have a class that declares and implements this : - (void) callbackme:(OneClass*)p1 error:(NSString*)errStr
My function header is this: void FileIO::write(LinkedList<Librarian>& librarians, int numlibrarians, LinkedList<Patron>& patrons, int numpatrons,

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.