this question arbitrary i'll try explain best can. i'm looping through 2 strings of unknown size.
bool check(char *str1, char *str2) { char special = 'k'; (int size_t = 0; ; i++) { } }
i want terminating condition of loop following:
leave loop if either str1[i] == special or str2[i] == special, but not both.
for question, ignore fact might segment fault since know neither size nor checking 0x00
.
i know how write it's messy , involves using ternary conditional operators. better way write it?
you want xor operator written ^
use , &&
or or ||
. true if 1 not both arguments true.
Comments
Post a Comment