[Solved] Why am I getting this output in C++? Explain the logic
NULL results in a false condition. You could imagine that NULL is a 0, so this: if(NULL) would be equivalent to this: if(0) thus your code would become: #include <stdio.h> #include <iostream> int main() { if(0) std::cout<<“hello”; else std::cout<<“world”; return 0; } where is obvious that because 0 results to false, the if condition is … Read more