c - Accessing static global array from another file via function argument -
Segmentation error when accessing data from a static global array with another file; The indicator was passed as a function argument. Memory address shows the same from both files.
in file1.c
static long long T [12] [16]; ... / * inside some functions * / printf ("% p \ n", T); // address func_access_static (t) check; ... in file2.c
zero func_access_static (long ** t) {printf ("% p \ n", t) ; // shows the printf to the same address ("% lld \ n", t [0] [0]); // Partitioning partitioning mistake} Am I trying to do that which can not be done? Any suggestion is appreciated.
** is not equal to one thing
zero func_access_static (longer T [] [16]) or
zero func_access_static (long Time (* t) [16]) This is a 2 dimensional array int [2] [3] looks in memory tt [0] t [1] + --------- + --------- + ----- ---- + ------- - + --------- + --------- + | T [0] [0] | T [0] [1] | T [0] [2] | T [1] [0] | T [1] [1] | T [1] [2] | + --------- + --------- + --------- + --------- + --------- + --------- + A pointer on the corresponding memory cell type pointer int ** looks in memory Pointer pointer pointer + --------- + + --------- + --------- + | P | - & gt; | P [0] | P [1] | + --------- + + --------- + --------- + | | Somewhere in memory. | + --------- + --------- + --------- + | \ ---------- & gt; | P [1] [0] | P [1] [1] | P [1] [2] | | + --------- + --------- + --------- + | | Somewhere else in memory. + --------- + --------- + --------- + ------------------ - & gt; | P [0] [0] | P [0] [1] | P [0] [2] | + --------- + --------- + --------- + Use this to be a The syntax is but the operation is quite different.
Comments
Post a Comment