Thread: C Programming - Dynamically Populate an array of numbers and get the average

  1. #1
    Registered User
    Join Date
    Apr 2012
    Posts
    1

    C Programming - Dynamically Populate an array of numbers and get the average

    Hi All,

    Have a school assignment to pick up an undefined set of numbers (could be 3, or 10 or 5), store them and set the average of whatever I get. I would prompt for user input asking how many numbers the user will input, then, get these numbers, store them in an array and access the array with a sum.
    Any ideas?
    Oh, yeah...first time working with C.
    Tks in advance.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Search the board for "malloc" and you'll find lots of examples.
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Populate An Array With Numbers
    By mcertini in forum C++ Programming
    Replies: 6
    Last Post: 01-08-2011, 11:35 AM
  2. populate an array struct
    By flipguy_ph in forum C Programming
    Replies: 10
    Last Post: 04-17-2009, 04:07 PM
  3. FOR loop to populate a 2D array
    By Swerve in forum C++ Programming
    Replies: 7
    Last Post: 03-05-2008, 10:45 AM
  4. Wish to populate a 2D array using pointers
    By hamsteroid in forum C Programming
    Replies: 14
    Last Post: 10-24-2007, 10:28 AM
  5. Replies: 4
    Last Post: 03-03-2003, 03:52 PM

Tags for this Thread