How to pass the address of a double pointer to another double pointer?

The commented line uses sizeof(char*4) which presumably is four times the size of sizeof(char**) on the uncommented line.

The commented line uses sizeof(char*4), which presumably is four times the size of sizeof(char**) on the uncommented line.

So I can not find the size of s2 by using the sizeof(). I should make it manually? – Stelios May 16 at 10:50.

When using the sizeof operator, you will get the size of the array (in bytes). However, when applied to a pointer, you will get the size of the pointer, not the data it points to. In C, there is no way to find this information, so you must manage this manually, for example by having a size variable or (as you already have done) use the size of s1 (which will only work as long as s1 is an array).

Sizeof(s1) gives the total number of bytes in the outer array i.e. The size of the four pointers to the string arrays. On my machine this gives 16 bytes (each pointer is 32 bit).

Your declaration for s1 is eqivalent to doing: char *s14={"this","is","a","test"}; You can see those sizeof results for yourself: printf("sizeof(char4) == %d\n", sizeof(char*4)); // == 16 printf("sizeof(char**) == %d\n", sizeof(char**)); // == 4 Since s2 is a char** which is effectively a char* from point of view of the sizeof function, sizeof(s2) gives the size of a char* which on my machine is 4 bytes. If you want to assign s2 to s1 and print it out try this: #include #include #include int main(int argc, char* argv) { char *s1={"this","is","a","teeeeeeeeeeest"}; char **s2; s2 = s1; int numOfElementsInS1 = sizeof(s1)/sizeof(*s1); for(int I = 0; I.

Sizeof(s1)... gives total no. Of bytes.. what you are thinking cud be possibly implemented as follows: s2=malloc(sizeof(s1)*sizeof(char *)); s20 = malloc(sizeof(s10)*sizeof(char)) . .. .

N so on.

The address of a double pointer is passed (without quotes):. Pass the address of a double pointer.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions