Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/28/01 21:03
Read: times


 
#12873 - RE: Problem in initialising structure
A structure is just an array and can be initialized by c_init.

Typedef the structure. This describes the structure but sets aside no memory for it.
In file declare.h

typedef struct param{
float value[10];
char mode [10];
}TParam;

In file main.c

#include declare.h

/* Declare the structure. Sets aside memory */
TParam Parameter;

/* Initialize structure */
Parameter = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};

main(){
/* Parameter is initialized in c_init
and does not need to be done here. */
}/* end main */


All of my structures that need initalization at startup are done this way.

Good luck!
Allen

List of 7 messages in thread
TopicAuthorDate
Problem in initialising structure            01/01/70 00:00      
RE: Problem in initialising structure            01/01/70 00:00      
RE: Problem in initialising structure            01/01/70 00:00      
RE: Problem in initialising structure            01/01/70 00:00      
RE: Problem in initialising structure            01/01/70 00:00      
RE: Problem in initialising structure            01/01/70 00:00      
RE: Problem in initialising structure            01/01/70 00:00      

Back to Subject List