Produce the correct code

Assignment Help C/C++ Programming
Reference no: EM13938920

The following code fragment produces the correct result sometimes and sometimes it does not. Explain what is happening and why.

#include <stdio.h>
#define max(a,b) ((a) > (b) ? (a): (b))
void main(void)
{
int i = 0;
int j = 0;
int a = 3;
int b = 4;
int c = 6;
int d = 5;
i = max(a,b);
j = max(c,d);
printf("i = %i, j = %in",i,j);
i = max(a++, b++);
printf("a = %i, b = %in",a,b);
j = max(c++,d++);
printf("c = %i, d=%in",c,d);
return;
}

Reference no: EM13938920

Questions Cloud

Program that asks the user to enter a number from 1 to 50 : Print the statement "Programming is fun" the number of times entered by the user using a for loop.
Importance to consumer behaviour and marketing : Discuss the concept of perceived value and its importance to consumer behaviour and marketing. Discuss the theory and then give practical examples of how customers perceive various brands and how this impacts on their behaviour.
Calculate all the relevant overhead variances : Calculate all the relevant overhead variances for the department, and write a memo that describes what each one means.
Identify the blood vessel that is probably involved : Explain symptoms a through c. Where is the lesion (area of CNS and side)? Identify the blood vessel that is probably involved.
Produce the correct code : The following code fragment produces the correct result sometimes and sometimes it does not. Explain what is happening and why.
Approach to investing in foreign markets : Critically discuss the methods and theories that might be used by a company to help it decide its approach to investing in foreign markets.
Explain which company appears to be the most liquid : Below are three ratios calculated for Huey, Louie, and Dewey Companies for 2008 and 2009. Explain which company appears to be the most liquid.
What medical test best confirm reasoning for patient symptom : What would you consider is a major medical complication for this patient other than the newly diagnosed stroke? Please consider the appropriate classification and type of condition for this patient's pulmonary diagnosis. Provide rationale for your..
Characteristics affecting consumer behaviour : Writing Task In the assessment block you will find the task "Portfolio task 2 - Consumer behaviour". Provide an advertisement for a product you regularly use or consume - it can be a print ad from a newspaper or magazine or it can be a TV ad if yo..

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Reads a set of integers from file

The code in file "hw5-stree.cpp" reads a set of integers from file and inserts them into a binary search tree. You are asked to implement two functions max() and depth() that compute the maximum element and the depth of the binary search tree.

  Implement the bisection method for solving given equations

Implement the Bisection Method for solving equations. Use the following function: double root(double (*pf)(double x), double a, double b, int n).

  What are the advantages of using an ordered array

What are the inefficiencies associated with using an unordered array if duplicates are not allowed? What are the advantages of using an ordered array? When would using an unordered array be preferred over using an ordered array

  Define a structure to store marks of a student

Define a structure to store roll no, name and marks of a student - using the structure of Q2. a), above write a 'C' program to create a file "student.dat". There must be one record for every student in the file.

  Write a program to determine the cost of painting a room

implement the program to find the cost of painting a room - Write a program to determine the cost of painting a room.

  Write the two redox half-reactions

How would I write the two redox half-reactions for these: Ag/Ag+| | H+/H2 Cu/Cu2+| | H+/H2 H2/H+| | Zn2+/Zn

  Write a c function for reversing circular single linked list

Let A and B be two structures of type linked list. Write a function for creating new linked list C that contains elements alternately from A and B beginning with first element of A. If you run out of the elements in one of the lists then append the r..

  Write a program that find the average time spent programming

Write a program that finds the average time spent programming by a student each day over a 3 day period.

  Write a c program that will calculate the gross pay

Write a C program that will calculate the gross pay of a set of employees. For each employee the program should prompt the user to enter the clock number, wage rate, and number of hours as shown below.

  Code for the process management simulation

Its C++ in a linux environment for Process Management Simulation

  Create a variable that asks user what their monthly income

On average people in Las Cruces spend between 12-16% of their annual income on entertainment. Create a variable that asks the user what their MONTHLY income is and have an fprintf statement that says

  Formulate an linear programming model

1. Formulate an Linear Programming model for this problem 2. Create a spreadsheet model for this problem and solve it using Solver 3. What is the optimal solution?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd