IT2240 UNIT 4 ASSIGNMENT

Unit 4

Content

  • Print
  • Functions and Pointers Introduction Functions in C allow the programmer to reuse sequences of instructions by name rather than having to retype the actual underlying code. There are many useful functions included in the C standard library, but programmers also create their own functions. Functions can both receive input data from and return data to the sections of the program that call them. Pointers provide a powerful and flexible way to access data in memory and share it between different parts of a program. Pointers are a very useful tool, but programmers must use them carefully to avoid problems. Objectives To successfully complete this learning unit, you will be expected to:
    1. Organize and reuse code efficiently using custom functions.
    2. Use pointers to access data stored in memory.
    3. Use pointers and heap memory effectively.

  • Learning Activities Collapse All
  • Toggle Drawer [u04s1] Unit 4 Study 1 Studies Use your C Programming: Absolute Beginners Guide text to read the following:
    • Chapter 24, “Solving the Mystery of Pointer,” pages 221–229.
    • Chapter 25, “Arrays and Pointer,” pages 231–241.
    • Chapter 26, “Maximizing Your Computer’s Memory,” pages 243–255.
    • Chapter 30, “Organizing Your Code With Functions,” pages 285–292.
    • Chapter 31, “Passing Variables to Your Functions,” pages 293–303.
    • Chapter 32, “Returning Data From Your Functions,” pages 305–312.
    Use your Programming in C text to read: Chapter 7, “Working With Functions,” pages 119–160.
    • Chapter 10 (part), “Pointers,” pages 233–239, 251–275.
    Chapter 10 in Programming in C includes a discussion of using pointers with structures (structs) on pages 239–251. This course covers structs in the next unit, so you may want to wait until the next unit to read this section of the chapter. Optional Skillsoft Resource
    • Skillsoft. (n.d.). Java SE 8 fundamentals: Introduction to Java [Tutorial].
  • Toggle Drawer [u04d1] Unit 4 Discussion 1 Planning the Logic of the Program Before starting to write code, it is important to have a clear picture of what the program should do and the steps in the process for reaching the desired result. Choose either the program for part 1 or part 2 of this unit’s assignment and write out in plain English what the program needs to do and describe the steps in the process to solve the problem. Focus on a clear explanation of the process of solving the problem, not writing C. While it is a good idea to do this for both programs, you only need to discuss one in this post. Please focus on communicating in writing that is professional in tone and free of spelling and grammatical errors. Complete your initial post by Wednesday, 12:00 midnight Central Time. Response Guidelines Prior to Sunday evening, read and provide high-quality replies to at least two of your peers’ posts. In a constructive manner, point out areas of concern or of note. Include an example from your personal experience or reasoning, if applicable. Resources
    • Discussion Participation Scoring Guide.
  • Toggle Drawer [u04a1] Unit 4 Assignment 1 Programming in C: Unit 4 Exercises Part 1: Simple Grade Book, Version 1.1 Modify the grade book code from Unit 3 so that it uses heap memory to store percentage grades in the range from 0 to 100 (inclusive). The program should allow the user to indicate when he or she is done entering grades (since the user may not have grades to fill the whole array). When the user is done entering grades, the program should print out the grades entered by the user. Be sure to free the heap memory before the program ends. Part 2: Simple Grade Book, Version 2.0 Modify the grade book code from Unit 3 so that it uses 3 custom functions to calculate the average grade (arithmetic mean, not letter grade), report the highest grade, and find the lowest grade entered. This version of the program does not need to use heap memory, though you are welcome to do so. The program should allow the user to indicate when he or she is done entering grades (since the user may not have grades to fill the whole array). When the user is done entering grades, the program should print out the grades entered by the user. The program should also display the average grade, highest grade, and lowest grade. Be sure to include extended comments to explain the roles of your custom functions. When you submit your assignment, please be sure to include the .c source code files for both programs. Resources
    • Programming in C: Unit 4 Exercises Scoring Guide.
  • Toggle Drawer Updates and Handouts Periodically, information will be posted in this space for the good of the class.
 

"Are you looking for this answer? We can Help click Order Now"