Returning a pointer from a function

Nov 10th, 2013
KateS
Category:
Programming
Price: $15 USD

Question description

Your task is to write a subroutine that takes a pointer to the first element of an integer array, as well as an integer variable. The arguments are passed to the subroutine in this order. The integer variable passed as an argument holds the number of elements in an array, while the actual array holds the number of integers specified by the variable. 

The subroutine must go through the table and return the address of the element holding the smallest value to the calling program. After receiving the address, the main program uses it to print the smallest number contained in the array. 

The prototype of the subroutine is the following: 

int *address_of_smallest_value(int *numbers, int size); 

In the above, the * operator indicates that the function's return value is a pointer.

Tutor Answer

(Top Tutor) Daniel C.
(997)
School: Cornell University
PREMIUM TUTOR

Studypool has helped 1,244,100 students

8 Reviews


Summary
Quality
Communication
On Time
Value
Five Star Tutor
Dec 4th, 2016
" Outstanding Job!!!! "
SjSurvivor143
Nov 18th, 2016
" Thanks for the help. "
Joemoe
Nov 5th, 2016
" <3 it, thanks for saving me time. "
tinytim47
Oct 27th, 2016
" Wow this is really good.... didn't expect it. Sweet!!!! "
pmallory
Oct 22nd, 2016
" Totally impressed with results!! :-) "
mixedballz
Oct 13th, 2016
" excellent work as always thanks for the help "
kiln82
Sep 30th, 2016
" awesome work thanks "
darnay
Sep 21st, 2016
" The best tutor out there!!!! "
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1828 tutors are online

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors