Still getting confused with pointers...

Hi,

I would like to have an array of wchar so let say...

 
const WCHAR g_String[5][10] = {L"Str1", L"Str2", L"Str3", L"Str4", NULL};


And use it in a loop with a function call so let say...

1
2
3
4
5
6
7
//
// MyFunction(LPCWSTR param);

for (int i = 0; g_String[i] != NULL; i++)
{
	MyFunction(g_String[i]);
}



I played with it and I miss something to understand what to do with it.



It's an array of WCHAR as you said so the parameter of the function should be of type WCHAR like :

MyFunction (WCHAR param)

and when you pass the value inside the loop you wanna pass it like this :

MyFunction (g_String[i][j])

since it is a two dimension array, you gotta pass the index of the "column" and "raw".
(p.s: j is another int that refers to the column)
Topic archived. No new replies allowed.