1)I have some array info1 that is not a global variable
char info1[64]
I want to change the array inside the function that get the array.
My question is how to do it correctly.
The problem is that if I pass an array to a function, the actual array does not get passed.
The thing that does get passed is a pointer to the array. The size of
the pointer is 4 bytes (the address is 4 bytes for most compilers but
perhaps 8 bytes on some systems).
2)Dann Corbit told that me that if I need to tell the size of an array to a function, then I must
pass it in as a parameter or I can also wrap the array or the pointer to data in a struct and
pass that like this:
typedef struct tag_my_sizeable_thing {
char *data;
size_t data_length;
} my_sizeable_thing;
3)I still do not understand from this explanation how to tell function to change local array info1 correctly.
If you can give me an example how to do correctly only
memset(info1,'0', 64); inside a function that only get info1 and the size of it as parameters(info1 is used only in 2 files and I do not like it to be a global array) it can be productive
I guess that if the function gets only a pointer then memset(info1,'0',64) may change the content of other variables so of course it is not correct.
I can of course ask Dann Corbit about it but usually he is not available on sunday so I guess that I can get a faster reply here.
Uri