Originally Posted by
Joshua Green
Anyways, this problem is supposed to be about using incorrect tabs. Any input? I would think that nothing is printed, because only y=2, but x =/= 3.
I could just tell you the answer, but you will remember this better if you compiled and ran a program to find out:
Code:
#include <stdio.h>
int main(void)
{
int x = 4;
int y = 2;
if (x == 3 && y == 2)
printf("x is 3");
printf("y is 2");
printf("\n");
return 0;
}
Originally Posted by
Joshua Green
I put <tab> to represent pressing the tab key, because it changes system to system. I don't know if that's logical or not, but I didn't want to confuse.
Keep in mind that whitespace in not significant in this context, i.e., whether you use an actual tab character, or a number spaces equivalent to pressing the tab key on your text editor, or do not indent at all, the code is essentially the same. Indentation is for readability in C. So, this is an example of how the same indentation that can help in readability can also hinder by visually fooling the reader. Hence, I recommend that braces always be used, even when they are not necessary.