Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > General Computer Discussion > Software > Intialization and fill of an array of structures of type data

Thread Tools

Intialization and fill of an array of structures of type data

kim80109 kim80109 is offline
Junior Member
Join Date: Feb 2011
Posts: 1
The following program contains an array of structures of type data_t. The declaration for the variable ‘d’ of type data_t is given. Write logic into the main program to allocate memory for variable ‘d’ such it contains an array of 500 elements, each of type data_t. Don’t be concerned with freeing the memory or testing the return value of malloc for NULL. Then, write function ‘f1’ to fill in each of the 500 elements of the array such that the integer field ‘ival’ has the values 1-500 for array indexes 0-499 respectively, and the string field ‘sval’ contains the string “$1” – “$500” for array indexes 0-499 respectively. The call for function ‘f1’ is given at the end of the main program.

Hi All,

Need some help... kinda stuck with an segmentation error. Much Appreciated!
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
array intialization for primitives Eric Java 9 11-22-2006 04:35 PM
Why Didn't The Creators Of Java Allow For Generic Array Intialization? Java 1 01-02-2006 06:20 AM
structures, structures and more structures (questions about nestedstructures) Alfonso Morra C Programming 11 09-24-2005 07:42 PM
Array intialization Drak I C++ 5 06-23-2004 10:11 AM
Type Casting IPv4 and IPv6 structures to Generic Structures tweak C Programming 14 06-11-2004 02:43 PM