Multidimensional Arrays and Pointers

So basically i've came across a strange thing:

1
2
char strings** smthing;
char strings[24][120];


Well, is that the same thing?
because if i make

1
2
3
char string **smthing;
smthing[1] = "lel";
//it just werks 

Can you explain me that?
So basically i've came across a strange thing:

1
2
char strings** smthing;
char strings[24][120];


Well, is that the same thing?

No.


because if i make

1
2
3
char string **smthing;
smthing[1] = "lel";
//it just werks  


Can you explain me that?

Yes. Dereferencing an uninitialized pointer results in undefined behavior. Anything can happen, including that it appears to work.

Last edited on
I just have a library that as parameters for a function has
1
2
3
4
void myfunc(const char **params)
{
  //lel
}


And when i need to access a "param" i would type accordingly
params[0] or params[1]
Topic archived. No new replies allowed.