bool checkSubarraySum(int* nums, int numsSize, int k) {
int i, s, found = 0;
e_t buff[10000];
int n;
e_t *set[SZ] = { 0 }, *e;
put(set, &buff[n ++], 0, -1);
s = 0;
for (i = 0; i < numsSize; i ++) {
s += nums[i];
if (k) s = s % k;
e = lookup(set, s);
if (e) {
if (i - e->idx >= 2) {
found = 1;
break;
}
} else {
put(set, &buff[n ++], s, i);
}
}
return found;
}
What is e_t *set[SZ] = { 0 }, *e;
doing? e_t
is a user defined type but I don't think that matters. e
is not a pointer that has been defined anywhere in global scope to my knowledge, and I tried something like the following:
int *array[5] = {0}, *u;
and no syntax errors were given. The first part, i.e. int *array[5] = {0}
initializes all five elements of this array to 0. But what is the purpose of *u
? You can't just assign an array to something else, right, it's an address, not a pointer. And u has never even been defined, so, I would expect some sort of NameError...
Thanks for any help in advance.