Global Structure not completley initializing.....
Posted: Sun Apr 22, 2007 2:39 pm
I've got an array of structs:
Where job is
The integer priority initializes and so do the rest, but not the char *name. (I get "(null)") I've checked this out else where and I think it's supposed to work. The array is global, and does not change. I've also checked initialization in K+R's book, and it says a character array can be initialized by a string literal. So, I'm at a loss.
Why wouldn't the char* be initializing, but everything else is?
Code: Select all
job instruction_list[INSTRUCTION_COUNT] = {
{ 5, 1, 0, NULL, "load_bin_file\0" },
{ 5, 1, 0, NULL, "load_com_file" },
{ 5, 1, 0, NULL, "cpu" },
{ 5, 1, 0, NULL, "mem" },
{ 7, 1, 0, NULL, "load_device" },
{ 2, 1, 0, NULL, "randomize_memory" }
};
Code: Select all
struct job {
int priority;
int arg_count;
ll args;
char *name;
int flags;
};
Why wouldn't the char* be initializing, but everything else is?