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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T13:27:02+00:00 2026-06-12T13:27:02+00:00

This continues from my previous question . I have an array, and want to

  • 0

This continues from my previous question.

I have an array, and want to find the biggest numbers in it. But I can’t sort then, ’cause is very important indexes of the numbers, so the can’t be moved. And finally, the output of my problem should be “the biggest number/s are in index 1 and 4, with the number 8. Here is the array:

int anonarray[5] = {3,8,7,5,8};
  • 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-12T13:27:03+00:00Added an answer on June 12, 2026 at 1:27 pm
    enum { MAX_ENTRIES = 5 };
    int anonarray[MAX_ENTRIES] = { 3, 8, 7, 5, 8 };
    int maxval = anonarray[0];
    int maxidx[MAX_ENTRIES] = { 0, 0, 0, 0, 0 };
    int maxnum = 1;
    
    for (int i = 1; i < MAX_ENTRIES; i++)
    {
        if (maxval < anonarray[i])
        {
            /* New largest value - one entry in list */
            maxval = anonarray[i];
            maxnum = 1;
            maxidx[0] = i;
        }
        else if (maxval == anonarray[i])
        {
            /* Another occurrence of current largest value - add entry to list */
            maxidx[maxnum++] = i;
        }
    }
    
    printf("The biggest number is in %s", ((maxnum > 1) ? "indices" : "index"));
    const char *pad = " ";
    for (int i = 0; i < maxnum - 1; i++)
    {
        printf("%s%d", pad, maxidx[i]);
        pad = ", ";
    }
    printf(" %s%d, with value %d.\n", ((maxnum > 1) ? "and " : ""),
           maxidx[maxnum-1], maxval);
    

    Note that internationalizing that English-specific formatting will not necessarily be easy!

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

Sidebar

Related Questions

This continues from a previous question . I tried the suggested fix to check
I've looked but didn't find previous questions specific enough, so sorry if this is
This is the continual question from this previous question I've asked: Change Database Column
From a previous question , I have the following: So I have implemented a
This maybe a continuation from 2 of my previous question, or maybe it's a
Introduction I have a question coming from this one: Loop calling an asynchronous function
And my confusion with JSF continues. This is a continuation of a question asked
I know this is more heavy question, but I think its interesting too. It
This question is in continuation to my previous post located here . Since there
I know this question has been asked already but I would like to solve

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.