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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:50:36+00:00 2026-05-22T12:50:36+00:00

I just want to ask something about my code. #define LIM 40 main() {

  • 0

I just want to ask something about my code.

#define LIM 40

main()
{
       int day=0;
       float temp[LIM];

       clrscr();

       do
       {
               printf("Enter temperature for day %d.", day);
               scanf("%f", &temp[day]);
       }
       while(temp[day++] > 0)
}

I’m using TurboC, this code repeatedly asks the user to enter a temperature and stores the responses in the array temp, until a temperature of 0 or less is entered. I’ve used a #define directive to give the identifier LIM the value of 40 because I want this program to accept any number of temperatures up to 40. But It actually accepts up to 48… What should I do so that it could accept up to 40 only?

Thanks in advance

  • 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-22T12:50:37+00:00Added an answer on May 22, 2026 at 12:50 pm

    Change the condition in while to the following: while (temp[day++] > 0 && day < LIM).

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

Sidebar

Related Questions

At the risk of being downmodded, I want to ask what the best mechanism
I'm here to ask a specific topic - I really found few info about
Got a little problem i asked about it before but maybe i didnt ask
Suppose there is a function with 1000 code of line named LongFunction, and we
In the code-behind style of ASP.NET programming, you split your code into two different
For my first and most awesomest Android project, I want to create a home
It makes sense that something like an operating system would be written in C.
Is it possible to make a C++ header file (.h) that declares a class,
I was suggested when I have some further questions on my older ones, to
I'm currently in the process of developing a fairly large static library which will

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.