I’ve declared the following array of strings:
char *arrayIndices[100] = {0};
I do a comparison with recp->ut_line which is declared as:
struct utmp {
....
char ut_line[32]
}
using:
strcmp(arrayIndices[i], (char*)recp->ut_line))
This gives me a segmentation error.
I’ve also tried these in gdb:
if (arrayIndices[i] == NULL)
if (arrayIndices[i] == "\0")
The second one turns up false. arrayIndices[i] shows a value of 0x0 when printed out.
You need to use apostrophes, not quotes, here:
if (arrayIndices[i] == '\0')