Professional Documents
Culture Documents
STD Main ( (I I - ) (Cout ) ) : Using Namespace Int Int in For Int in
STD Main ( (I I - ) (Cout ) ) : Using Namespace Int Int in For Int in
STD Main ( (I I - ) (Cout ) ) : Using Namespace Int Int in For Int in
int main() {
int in = 5;
return 0;
}
Output : Go Go Go Go Go
Since variable “i” is defined globally, it is initialized with default value 0.
Switch statements doesn’t work for floating-point values.
#include <stdio.h>
int main()
{
int i = 0;
switch (i)
{
case '0': printf("Geeks");
break;
case '1': printf("Quiz");
break;
default: printf("GeeksQuiz");
}
return 0;
}
Output : GeeksQuiz
REASON : But, the cases are labeled with characters which get converted to their ASCII
values 48(for 0) and 49(for 1). None of the cases is labeled with value 0
int i;
i = 1, 2, 3;
printf("%d", i);
Comma acts as an operator. The assignment operator has higher precedence than the
comma operator. So, the expression is considered as (i = 1), 2, 3 and 1 gets assigned to the
variable i.
In C, functions can return any type except only :arrays and functions. We can get around this
limitation by returning pointer to array or pointer to function.