0% found this document useful (0 votes)
28 views

Lab Arrays Debugging

This document provides instructions for two exercises in a laboratory on arrays and debugging in C. The first exercise has the student modify code to eliminate duplicate entries in an integer array, first of size 5 taking user input, then of size 30 holding random numbers between 20-600. The second exercise is to debug provided code so it compiles and runs correctly, comparing output to a sample file.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views

Lab Arrays Debugging

This document provides instructions for two exercises in a laboratory on arrays and debugging in C. The first exercise has the student modify code to eliminate duplicate entries in an integer array, first of size 5 taking user input, then of size 30 holding random numbers between 20-600. The second exercise is to debug provided code so it compiles and runs correctly, comparing output to a sample file.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

ICOM 4035 Laboratory

Laboratory 5: Arrays & Debugging


Exercise 1: Duplicate Elimination
A. Given an array of size 5, read user input into the array. Each time a value is inserted
into the array, the array elements are printed. If the user attempts to input a value that
already exists in the array, the program will print the given value with a message to the
effect that the value already exists.
Code: lab_duplicate
Example:
Array Size: 5
Enter number: 1
1
Enter number: 2
12
Enter number: 1
12
1 has already been entered
Enter number 3:
123
Enter number: 4
1234

B. Modify the code from item A in order for the array to hold 30 numbers, which will be
between 20 and 600, inclusive.
C. Modify the code from item B to allow the user to enter numbers until the array is full.
D. Modify the code from item C to allow the user to set the array size.

Exercise 2:
Fix all the compilation errors, so that the program will compile successfully. Once the
program compiles, compare the output to the sample output, and eliminate any logic
errors that exist. The sample output demonstrates what the programs output should be
once the programs code is corrected.
Code: lab_debugging
Example: See debugging_sampleOutput.txt

You might also like