c - Struct array is printing garbage -
I am having a problem with printing my straight array, it is started like this:
Then I try to print it with this code: Why does it return anyway And I'm not sure Why. I'm also using the array for loop using the array as well. you said started it Like But the above announcement is not not started nothing (unless your array is declared with a constant storage period). The garbage will initially include a local array declared in this fashion, apparently what you are printing. If you want your array initialized , you have to start it yourself, for example, this announcement Will start everything with zero, say If struct matrix token [NBRTE] [12];
printf ("% d", token [0] [0] .state ); (Int q = 0; q & lt; nbrState; q ++) for {for (int r = 0; r
-11412982687586982664593143168004196116665039881600950398592587297673016950398176950397984091005908849605884315520000050-100950398592419
while (fscanf (fp, "% d /% d% c", and index, and isolated, inc., And separator) == 3) = 0; I
structure matrix token [nbrtte] [12];
structure matrix token [ NBRTE] [12] = {0};
nbrState is a constant.
nbrState is not static, you will not be able to use
= {...} initializer in the declaration. You must manually assign your array elements to the initial value manually in a circle or some other way.
Comments
Post a Comment