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

  • SEARCH
  • Home
  • 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 6914433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:20:48+00:00 2026-05-27T09:20:48+00:00

I believe I have carefully read the entire printf() documentation but could not find

  • 0

I believe I have carefully read the entire printf() documentation but could not find any way to have it print out, say, the elements of a 10-element array of float(s).

E.g., if I have

float[] foo = {1., 2., 3., ..., 10.};

Then I’d like to have a single statement such as

printf("what_do_I_put_here\n", foo);

Which would print out something along the lines of:

1. 2. 3. .... 10.

Is there a way to do that in vanilla C?

  • 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-27T09:20:49+00:00Added an answer on May 27, 2026 at 9:20 am

    you need to iterate through the array’s elements

    float foo[] = {1, 2, 3, 10};
    int i;
    for (i=0;i < (sizeof (foo) /sizeof (foo[0]));i++) {
        printf("%lf\n",foo[i]);
    }
    

    or create a function that returns stacked sn printf and then prints it with

    printf("%s\n",function_that_makes_pretty_output(foo))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I believe I have read this somewhere, but I can't find it nomatter how
I want to print from a servlet. I believe I have the correct syntax.
I believe several of us have already worked on a project where not only
I believe I have a good answer to this issue, but I wanted to
This is something that I cannot believe I have not been able to figure
I have searched for how to correctly do this, but I don't believe I
I believe I have been taking the right approach to this so far, but
I believe I have disabled the view state on all controls as well as
I believe I have a potential threading issue. I have a user control that
I believe I have found a weird bug as follow: I want to delete

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.