Purchase Solution

Evaluation of Conditional Expressions in the C language

Not what you're looking for?

Ask Custom Question

What will be printed by the following code?

int a = 3;

if (a <= 5)

if (a < 2)

printf("a is less than 2n");
else
printf("a is greater than 5n");
printf("done");

Why does this occur?

What if the initial value assigned to a is 13, not 3? What happens with this code and why does this occur? What does this tell you about setting up conditional expressions in the C language?

Purchase this Solution

Solution Summary

Shows how to interpret conditional expressions, such as if .. else so that the code works properly with the help of braces.

Solution Preview

This happens because when properly formatted the code is like following.
int a = 3; //or a =13

if (a <= 5){
if (a < 2){
printf("a is less than 2n");
else
printf("a is greater ...

Purchase this Solution


Free BrainMass Quizzes
Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.

Javscript Basics

Quiz on basics of javascript programming language.

Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.