subject

You are given a file named hw02q3.c. All instructions are given in the form of comments in the file. You are to again run the file in both GCC and Visual Studio (2017 or 2015 version). Observe the outputs and make changes as asked.#include #pragma warning(disable : 4996) // needed in VS// CSE 240 Fall 2018 Homework 2 Question 3 (25 points)// Note: You may notice some warnings when you compile in GCC or VS, that is okay.#define positive_1(x) ((x > 0) ? x : 0)#define polynomial_2(a, b) (a*a + 2*a + 4*a*b - b*b)int function_1(int a, int b) {return (a*a + 2*a + 4*a*b - b*b);}// Part 1:// We want to pass the value of 11 to positive_1 and expect the result of positive_1 to be 11, why is the result 12? Correct the error (5 points)void part1(int x) {int result;result = positive_1(++x);printf("positive_1( 11) = %d \n\n", result);// Why did this error occur? Please provide the answer in your own words below:printf("Explanation: \n\n\n"); // (2.5 points)}// Part 2:// We want to pass incremented values of x and y to the macro and function to compare their outputs in VS and GCC.// Correct the program so that function_1 and polynomial_2 produce same correct output of 371. // (5 points)// Run this program in Visual Studio(VS) and then again in GCC. Note the output values for function_1 and polynomial_2.void part2(int x, int y) {int x_copy = x, y_copy = y;printf("function_1(x, y) = %d \n polynomial_2(x, y) = %d \n\n", function_1(++x, ++y), polynomial_2(++x_copy, ++y_copy));// Replace the 4 blank spaces below with the actual output observed when running the code in VS and GCC. printf("In VS : the result of function_1 = __ and polynomial_2 = __ \n"); // (5 points)printf("In GCC: the result of function_1 = __ and polynomial_2 = __ \n\n"); // (5 points)// Explain in a short sentence why VS and GCC could possibly produce a different value for the same program and for the same input. printf("Explanation: \n\n"); // (2.5 points)}// Do not edit main()int main(){int x = 10, y = 5;printf("Part 1:\n\n");part1(x);printf("Part 2:\n\n");part2(x, y);return 0;}

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 03:00
What are the different parts of computer
Answers: 2
question
Computers and Technology, 23.06.2019 07:50
Apython programming question: assume s is a string of lower case characters. write a program that prints the number of times the string 'bob' occurs in s. for example, if s = 'azcbobobegghakl', then your program should print number of times bob occurs is: 2
Answers: 3
question
Computers and Technology, 23.06.2019 17:30
When making changes to optimize part of a processor, it is often the case that speeding up one type of instruction comes at the cost of slowing down something else. for example, if we put in a complicated fast floating-point unit, that takes space, and something might have to be moved farther away from the middle to accommodate it, adding an extra cycle in delay to reach that unit. the basic amdahl's law equation does not take into account this trade-off. a. if the new fast floating-point unit speeds up floating-point operations by, on average, 2ă—, and floating-point operations take 20% of the original program's execution time, what is the overall speedup (ignoring the penalty to any other instructions)? b. now assume that speeding up the floating-point unit slowed down data cache accesses, resulting in a 1.5ă— slowdown (or 2/3 speedup). data cache accesses consume 10% of the execution time. what is the overall speedup now? c. after implementing the new floating-point operations, what percentage of execution time is spent on floating-point operations? what percentage is spent on data cache accesses?
Answers: 2
question
Computers and Technology, 24.06.2019 02:10
Which sentences describe the things you need to ensure while creating a sketch and a drawing? while an artistic or creative drawing is a creative expression, a technical drawing is an informative expression. you need to create accurate and neat drawings to convey accurate information. a technical drawing clearly conveys its meaning or information, and does not leave room for interpretation maintain a good speed while creating drawings
Answers: 1
You know the right answer?
You are given a file named hw02q3.c. All instructions are given in the form of comments in the file....
Questions
question
Mathematics, 09.03.2021 01:00
question
English, 09.03.2021 01:00
question
Mathematics, 09.03.2021 01:00
question
Mathematics, 09.03.2021 01:00
question
Physics, 09.03.2021 01:00
question
Spanish, 09.03.2021 01:00
question
Mathematics, 09.03.2021 01:00
question
Mathematics, 09.03.2021 01:00