{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

hw8_solution - EME5 Homework 8 Solutions 3 Chapter 11...

Info icon This preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
EME5 Homework 8 Solutions November 19, 2010 3 Chapter 11, Problem 9 Determines the length of a string. 4 Chapter 11, Problem 10 4.1 Solution Code typedef int *(*FUNPTR)(double x, double y); FUNPTR fptr; int *function(double x, double y) { int *retval; /* retval points to a global variable or dynamically allocated memory */ return retval; } 5 Chapter 11, Problem 12 i = 20 p2 = 20 6 Chapter 11, Problem 15 6.1 Part f 7 6.2 Part g 3 1
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
6.3 Part h 7 6.4 Part i 4 6.5 Part j 8 7 Chapter 11, Problem 18 7.1 Solution Code #include <stdio.h> #define YEAR 2 #define MONTH 12 const char *month[12] = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"}; int main() { double a[][MONTH] = {367, 654, 545, 556, 565, 526, 437, 389, 689, 554, 526, 625, 429, 644, 586, 626, 652, 546, 449, 689, 597, 679, 696, 568}; int i, j; double monthtotal, meanval; printf("%-12s%-12s\n", "Month", "Sale (x1,000 $)"); printf("---------------------------\n"); for(i = 0; i < MONTH; i++) { monthtotal= 0; for(j = 0; j < YEAR; j++) { monthtotal += a[j][i]; } meanval = (double)monthtotal/YEAR; printf("%-10s%8.2f\n", month[i], meanval); } return 0; } 2
Image of page 2
7.2 Solution Output Month Sale (x1,000 $) --------------------------- January 398.00 February 649.00 March 565.50 April 591.00 May 608.50 June 536.00 July 443.00 August 539.00 September 643.00
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern