Thread: Im so lost at . .

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User hermit's Avatar
    Join Date
    Apr 2002
    Posts
    213

    Need help with pointers

    POINTERS

    Here is the code:

    #include <stdio.h>
    #define SIZE 7

    void display_marks( float *, int);

    int main()
    {
    float marks[SIZE] = {10, 11, 12, 13, 14, 15, 16};
    display_marks(marks, SIZE);
    }

    void display_marks(float *p, int size)
    {
    int i;
    for(i=0; i<SIZE; i++)
    printf("%.2f\n", p[i]);
    }
    This is a working program, but i do not understand a few tasks..

    a couple of questions i need to ask:
    1. at void display_marks( float*, int)
    what does float* do? how come it is intialise at float*, pointing to what?what does it mean?call to function , isnt it passing the value of float marks[SIZE] instead?

    2. void (float *p, int size)
    again, how come it is float*p now? pointing to what?
    an last but not least how come, p[i] prints the value of the array


    peat and repeat IM LOST, if you could help please explain in simple english. Thanks guys
    Last edited by hermit; 05-14-2002 at 08:35 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. The getting lost and walking in circles
    By Mario F. in forum A Brief History of Cprogramming.com
    Replies: 26
    Last Post: 05-07-2008, 09:53 AM
  2. I lost my laptop, DVD and money
    By Sang-drax in forum A Brief History of Cprogramming.com
    Replies: 21
    Last Post: 10-01-2004, 07:13 PM
  3. lost disk
    By Benzakhar in forum Linux Programming
    Replies: 7
    Last Post: 01-11-2004, 06:18 PM
  4. Lost ID number
    By ripper079 in forum C++ Programming
    Replies: 13
    Last Post: 10-04-2002, 12:51 PM
  5. API, LOST... help
    By Unregistered in forum Windows Programming
    Replies: 5
    Last Post: 03-13-2002, 03:19 PM