My code calls a function that passes a boolean array and will return a character according to a global char array, depending on which boolean array value is 1. The code below is intended to a return a '2'. However when I add kp_keyPressed as a watch expression it shows that the value returns a '.' I'm not an expert dealing with arrays but from the code I've gone through online, my method of passing an array should work. Is there something weird about CCS that makes it so that this operation fails? Does the watch expressions table have some glitches when it comes to arrays? If the answers to those questions are no, is there something I'm doing wrong in the code below? Should I just steer clear of attempting to pass char arrays to functions? I am running the code on a 377S launchpad. Would appreciate any feedback. Thanks!
char KP_Key[16] = {"123A456B789C*0#D"};
Uint16 KP_Test[16] =
{
{0,1,0,0,
0,0,0,0,
0,0,0,0,
0,0,0,0}
};
char KP_FindKey(Uint16 array[16])
{
Uint16 i = 0;
char Key = 0;
for (i=0;i<16;i++)
{
if(array[i] == 1)
{
Key = KP_Key[i];
}
}
return Key;
}
void main()
{
char kp_keyPressed = KP_FindKey(KP_Test);
}