#include <stdio.h>
int main(void) {
int i = 0;
char c = 0;
char *s = "teste";
void *p = NULL;
printf("%d %c %s %p\n", i
, c
, s
, p
); if (!c
) printf("i ok\n"); //verifica se não é zero if (!c
) printf("c ok\n"); //verifica se não é um caractere nulo if (!s
[5]) printf("s ok\n"); //verifica se o 6o. caractere é o terminador if (!p
) printf("p ok\n"); //verifica se o ponteiro não é nulo // if (p == i) printf("p NULL ok\n"); //tipos incompatíveis sendo comparados
}
//http://pt.stackoverflow.com/q/177619/101
I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgbWFpbih2b2lkKSB7CglpbnQgaSA9IDA7CgljaGFyIGMgPSAwOwoJY2hhciAqcyA9ICJ0ZXN0ZSI7Cgl2b2lkICpwID0gTlVMTDsKCXByaW50ZigiJWQgJWMgJXMgJXBcbiIsIGksIGMsIHMsIHApOwoJaWYgKCFjKSBwcmludGYoImkgb2tcbiIpOyAvL3ZlcmlmaWNhIHNlIG7Do28gw6kgemVybwoJaWYgKCFjKSBwcmludGYoImMgb2tcbiIpOyAvL3ZlcmlmaWNhIHNlIG7Do28gw6kgdW0gY2FyYWN0ZXJlIG51bG8KCWlmICghc1s1XSkgcHJpbnRmKCJzIG9rXG4iKTsgLy92ZXJpZmljYSBzZSBvIDZvLiBjYXJhY3RlcmUgw6kgbyB0ZXJtaW5hZG9yCglpZiAoIXApIHByaW50ZigicCBva1xuIik7IC8vdmVyaWZpY2Egc2UgbyBwb250ZWlybyBuw6NvIMOpIG51bG8KLy8JaWYgKHAgPT0gaSkgcHJpbnRmKCJwIE5VTEwgb2tcbiIpOyAvL3RpcG9zIGluY29tcGF0w612ZWlzIHNlbmRvIGNvbXBhcmFkb3MKICAgIHByaW50ZigiJXp1Iiwgc2l6ZW9mKCd4JykpOwp9CgovL2h0dHA6Ly9wdC5zdGFja292ZXJmbG93LmNvbS9xLzE3NzYxOS8xMDE=