!substring[k]

Hi! I'm writing a program that records the number of apparitions of a substring in a string. The code is taken from a c++ manual but i do not understand exactly what that if statement is doing !subsir[k+1]. Is it returning a boolean value? The program works fine but i'm stuck at that line
1
2
3
4
5
6
7
char sir[50], subsir[50];
int nr = 0;

  for (int i = 0; sir[i]; i++)
		for (int j = i, k = 0; sir[j] == subsir[k]; j++, k++)
			if (!subsir[k + 1])
				nr++;
!subsir[k + 1] ise equivalent to subsir[k + 1] == '\0'.
It checks if we hit null terminator on that string.
Topic archived. No new replies allowed.