yet another array question
letMeIn
Posts: 15
here it is
char phone_num[20]
integer count
Define Start
count =1
Define Event
button_event[TP,1]
.
.
.
.
button_event[TP,10]
{
push:
{
if(button.input.channel==10)
phone_num[count]='0'
else
phone_num[count]=itoa(button.input.channel)
count++
}
}
Im trying to save the phone # the users enters in a char array. I just don't understand why even if I set the size of my array to 20, I can't populate individual cells. While debugging array constantly remains empty.
char phone_num[20]
integer count
Define Start
count =1
Define Event
button_event[TP,1]
.
.
.
.
button_event[TP,10]
{
push:
{
if(button.input.channel==10)
phone_num[count]='0'
else
phone_num[count]=itoa(button.input.channel)
count++
}
}
Im trying to save the phone # the users enters in a char array. I just don't understand why even if I set the size of my array to 20, I can't populate individual cells. While debugging array constantly remains empty.
0
Comments
I just tested the above code and it seems to work fine. It is displaying properly in the debug window using Emulate device button pushes. I handled the char conversion in two different ways, choose the one you like best
Jeff
I think the count should increase every time to allow the 0 digit to be entered. The only problem is that count is going to eventually be larger than the array and will just throw INDEX too large at line xxx errors.
Jeff
Really appreciate, and so fast as well ..