Hello and thanks for reading.
I like to write C programs as my hobby and I rarely use functions for
my projects simply because most of my efforts are workable in the
domain of main().
I have read much in the past two days and have tried changing my code
but I am not getting it so even though I have searched and read a
bunch I need to have a little help with understanding passing and
using an array of structures in a function..
So, please forgive this Umpteenth million post on this subject but at
this time a voice of experience is what I need. I am confused.
This is my scenario.
I declare a pointer to a structure and use calloc() to allocate N-
I wish to have a function access that array so I try to send the
pointer to that array to that function (which is the pointer I
assigned to from calloc() ) and use it but I cannot get past errors
and warnings in GCC so I know I have forgotten something and reading
and changing code has simply frustrated me since I am not remembering
or understanding what I am reading.
I understand how to allocate the array of structures and using
pointers to access the elements of the array I can do in my main().
I seem to not know how to properly define a function that will
transfer access to an array of structures to a called function using
the pointer I created and calloc() assigned to.
I need guidance in remembering or learning what the defines must be
for both the Main() and the called FN().
I am allocating such as:
struct my_struct *struct_array_ptr ;
struct_array_ptr = calloc(......)
Function_Call( struct_array_ptr );
What is the right way to do this please?
It has been several years since I studied this and I am sure I have
comp.lang.c.moderated - moderation address: cl...@plethora.net
-- you must
have an appropriate newsgroups line in your header for your mail to be seen,
or the newsgroup name in square brackets in the subject line. Sorry.