Thread: Print numbers within a certain range of an Array

  1. #1
    Registered User
    Join Date
    Apr 2011
    Posts
    5

    Print numbers within a certain range of an Array

    I am trying to find the grades between certain numbers and then display them.

    I have the inputs set up to get the min and max, but I dont know how to get the printf/loop to display what I want.
    Last edited by omegasli; 04-10-2011 at 01:06 AM.

  2. #2
    Registered User
    Join Date
    Apr 2011
    Posts
    5
    Please come through for me! Someone has to know it!
    Last edited by omegasli; 04-10-2011 at 12:50 AM.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    > *grades >= min && *grades <= max
    You want this as an if statement inside your loop, not a condition for continuing the loop.

    Also, what is grades, and why are you incrementing it?
    Just use grades[i] to index it (whether it's a pointer or an array)
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Registered User
    Join Date
    Apr 2011
    Posts
    5
    Quote Originally Posted by Salem View Post
    > *grades >= min && *grades <= max
    You want this as an if statement inside your loop, not a condition for continuing the loop.

    Also, what is grades, and why are you incrementing it?
    Just use grades[i] to index it (whether it's a pointer or an array)
    Thank you SO MUCH.

    You are literally a lifesaver. This program has been quite a mess. Your info made it so I can finally be done with it.

  5. #5
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Quote Originally Posted by omegasli View Post
    You are literally a lifesaver.
    You should find a different school or job if they are threatening your life if you can't learn C.

    Quzah.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Generate numbers with a range and store to file.
    By carbonr in forum C++ Programming
    Replies: 9
    Last Post: 07-27-2010, 12:50 PM
  2. using rand() to create a range of numbers
    By keira in forum C Programming
    Replies: 7
    Last Post: 09-11-2007, 01:45 AM
  3. Random Numbers within a range OTHER than 1-X
    By Kaelin in forum C++ Programming
    Replies: 11
    Last Post: 02-16-2005, 11:57 AM
  4. Replies: 10
    Last Post: 11-23-2001, 10:01 AM
  5. generating random numbers within a range
    By tucky in forum C Programming
    Replies: 3
    Last Post: 09-14-2001, 12:59 PM