Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C program that reads a series of integer numbers and saves them into an array. Your program should then the user for an

Write a C program that reads a series of integer numbers and saves them into an array.
Your program should then the user for an integer to search within the array. If the value
exists within the array, the program should indicate where the value was found. If the
value doesnt exist in the array, the program should report that the value is not in the
array.
Requirements:
- Use pointer notation and pointer arithmetic to solve this problem.
- You can only use the [] operator to declare the array. The [] operator should not be
used anywhere else in your program.
Example Interaction (user input is underlined; your program must follow this format
precisely without the underline):
$ gcc -Wall a4_linear.c
$ ./a.out
Enter the number of input integers (0 to stop): -1
Invalid number
Enter the number of input integers (0 to stop): 0
$
$ ./a.out
Enter the number of input integers (0 to stop): 7
Enter numbers: 578014839170
20113647
What is the search number? 67
Not found: 67 is not in the array.
Enter the number of input integers (0 to stop): 0
$
$ ./a.out
Enter the number of input integers (0 to stop): 5
Enter numbers: 86
9886100-135002730
What is the search number? 86
Found: 86 is in position 0,2 in the array.
Enter the number of input integers (0 to stop): 0
$
$ ./a.out
Enter the number of input integers (0 to stop): 5
Enter numbers: 86
9886100
-13
What is the search number? -13
Found: -13 is in position 4 in the array.
Enter the number of input integers (0 to stop): 3
Enter numbers: 100
220
150
What is the search number? 20
Not found: 20 is not in the array.
Enter the number of input integers (0 to stop):
3
Enter numbers:
100
100
100
What is the search number?
100
Found: 100 is in position 0,1,2 in the array.
Enter the number of input integers (0 to stop): 0
$

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 31st International Conference Dexa 2020 Bratislava Slovakia September 14 17 2020 Proceedings Part 1 Lncs 12391

Authors: Sven Hartmann ,Josef Kung ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

303059002X, 978-3030590024

More Books

Students also viewed these Databases questions

Question

Discuss consumer-driven health plans.

Answered: 1 week ago