Problems with understanding a function

This is a discussion on Problems with understanding a function within the C Programming forums, part of the General Programming Boards category; hi I was reading a function in the stdio header file...but there is something that I don't understand: this is ...

  1. #1
    Registered User
    Join Date
    Feb 2005
    Posts
    30

    Problems with understanding a function

    hi

    I was reading a function in the stdio header file...but there is something that I don't understand:
    this is the function description:

    int fread (void * buffer, size_t size, size_t count, FILE * stream);

    what do we mean by void* ? does this mean that it can be a pointer of any type?
    and what is size_t ? why didn't they simple write int or long?

    thanks

  2. #2
    Registered User
    Join Date
    Mar 2005
    Posts
    18
    this void * buffer is a pointer to parameter buffer.
    The function fread reads nmemb elements of data, each size bytes long, from the stream pointed to by stream, storing them at the location given by ptr.

    wait to have help you!

  3. #3
    Registered User
    Join Date
    Feb 2005
    Posts
    30
    yes but what I don't understand is the type of the pointer to buffer. I mean is it of type char*? int*? long*? it can be any array? does "void* " mean I can pass any type of pointer?

  4. #4
    former member Brain Cell's Avatar
    Join Date
    Feb 2004
    Posts
    472
    void pointers are generic pointers , you use them to point to any type of data.
    My Tutorials :
    - Bad programming practices in : C
    - C\C++ Tips
    (constrcutive criticism is very welcome)


    - Brain Cell

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 05-13-2011, 09:28 AM
  2. Troubleshooting Input Function
    By SiliconHobo in forum C Programming
    Replies: 14
    Last Post: 12-05-2007, 07:18 AM
  3. Replies: 28
    Last Post: 07-17-2006, 12:35 AM
  4. Problem with Visual C++ Object-Oriented Programming Book.
    By GameGenie in forum C++ Programming
    Replies: 9
    Last Post: 08-30-2005, 12:21 AM
  5. Contest Results - May 27, 2002
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 18
    Last Post: 06-18-2002, 02:27 PM

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