pointers - What does int * and double ** mean for elements outside the C function's arguments? -


i learning c language , doing lot of practice. understand * , ** pointers in .c function.

please consider following function (another .c function)

void pcc(int* n, int* d, int* family, int* type, double* par, double* nu, double* out) {   int i, j, in=1, k, **fam;   double *w, **v, t, **theta, **x, **ny;     …some works  } 

my question is, why use pointer in argument of function? because understand use pointer point previous identifed elements.

also, why use pointer elements not defined in arguments of function. example, in last function define new element after writing argument of function:

 int i, j, in=1, k, **fam;       double *w, **v, t, **theta, **x, **ny; 

for instance, double *w not in argument of function! **v , other elements. how know must ** or *.

any please?

the reasons declaring variable * or ** countless, it's better try , grip of mean instead of getting hung on why they're used in specific instance.

a pointer * reference memory location value stored. in case of char reference single memorylocation holding byte, , in case of int it's 4 bytes on 32bit system.

you can pass pointer argument indicate want result stored. reason might efficiency. if have large struct it's better pass 4byte (on 32bit system) reference area of memory struct lies instead of loading entire struct on stack.

a ** double pointer. pointing specific memory location storing memory location of else.

char a[5]; 

here, variable char * pointing @ first element of a[], namely a[0].

char a[5][5]; 

here char **, pointing first element of a[][], namely a[0], return char * pointing @ a[0][0].

the second example better when want fiddle pointers. maybe have char** (an 'array of strings'), , want replace 1 of 'strings' (a string char[] in c), change char* pointed char**).

i hope makes little clearer you.


Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

transpose - Maple isnt executing function but prints function term -