K
Kamus of Kadizhar
I used to do lots and lots of C coding back in the pre-ANSI days. I just
picked up a project that has lots of pointers running around.
Now I'm seeing things like
char utf8char[6];
....
xxx = letter((char *)&utf8char);
where
void letter( char *somechar) {
....
}
Back in the "old" days we would have simply said:
char utf8char[6];
....
xxx = letter(utf8char);
so what's the purpose of the (char *)& shenanigans?
I mean, it works, so it must be right, but I always thought that using an
array name without the subscript returns a pointer to the first element
anyway....
--Kamus
picked up a project that has lots of pointers running around.
Now I'm seeing things like
char utf8char[6];
....
xxx = letter((char *)&utf8char);
where
void letter( char *somechar) {
....
}
Back in the "old" days we would have simply said:
char utf8char[6];
....
xxx = letter(utf8char);
so what's the purpose of the (char *)& shenanigans?
I mean, it works, so it must be right, but I always thought that using an
array name without the subscript returns a pointer to the first element
anyway....
--Kamus