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

This is a discussion on C Programming - Dynamically Populate an array of numbers and get the average within the C Programming forums, part of the General Programming Boards category; Hi All, Have a school assignment to pick up an undefined set of numbers (could be 3, or 10 or ...

  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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,452
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

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, 10: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, 09: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, 02:52 PM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21