What will be the output of the following C code?#include int main(){int a[5] = {1, 2, 3, 4, 5};int i;for (i = 0; i < 5; i++)if ((char)a[i] == '5')printf("%d\n", a[i]);elseprintf("FAIL\n");}

🎲 Try a Random Question  |  Total Questions in Quiz: 211  |  🧠 Study this quiz with Flashcards
This question is part of a full practice quiz:
C Programming Practice Test: Data Types, Operators and Expressions — practice the complete quiz, review flashcards, or try a random question.

Quiz questions on: Variable names, datatypes, constants, declarations, arithmetic operators, relational and logical operators, type conversions, bitwise operators, assignment operators, increment and decrement operators, conditional expressions, evaluation order and precedence. Data Types C has four basic data types: Char: This data type stores a single character. It can be signed or unsigned. Int: This data type stores an integer. It can be signed or unsigned. Float: This data type stores a floating-point number. Double: This data type stores a double-precision floating-point... Show more

What will be the output of the following C code?<br>#include <stdio.h><br>int main()<br>{<br>int a[5] = {1, 2, 3, 4, 5};<br>int i;<br>for (i = 0; i < 5; i++)<br>if ((char)a[i] == '5')<br>printf("%d\n", a[i]);<br>else<br>printf("FAIL\n");<br>}