V
Varun Sinha
I have an array of chars. I want to loop through it, compare each
element to different chars and depending on which character it
matches, take some action.
My problem is that I can't figure out how to compare array elements to
chars.
I wanted it to be something like this
if(array is 'A')
printf("BlahA");
else if((array is 'B') or (array is 'C'))
printf("BlahBC");
.....
.....
.....
I've been struggling with this for a while, and everytime would come
up with some ugly, makeshift hack to get the job done. But this time,
I needed it to do specifically this and couldn't find anything on the
net.
Thanks for the help!!!
Varun
element to different chars and depending on which character it
matches, take some action.
My problem is that I can't figure out how to compare array elements to
chars.
I wanted it to be something like this
if(array is 'A')
printf("BlahA");
else if((array is 'B') or (array is 'C'))
printf("BlahBC");
.....
.....
.....
I've been struggling with this for a while, and everytime would come
up with some ugly, makeshift hack to get the job done. But this time,
I needed it to do specifically this and couldn't find anything on the
net.
Thanks for the help!!!
Varun