Single quotes imply it's a character. So when you try z == '8', you're trying to compare a variable int to a char. z == 8 is how you would compare a variable int to an int.
#include <stdio.h>
int main()
{
int z = 8;
if (z == 8)
printf("the value stored in z is %d", z); // very simple output because of z's truth.
return 0; // returns value because main() is of integer type.
}