Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

pointer.c: /* * Type your name here: */ #include #include /* Display an int array */ void display_int(int array[], int length) { printf(Display integer array

image text in transcribed

pointer.c:

/* * Type your name here:  */ #include  #include  /* Display an int array */ void display_int(int array[], int length) { printf("Display integer array "); for (int i=0; i 

funcptr.c

/* * Type your name here: Name:  * * The program will first fill an array with pseudo random numbers. * Then it will display * > sum of the array * > minimum value of the array * > maximum value of th array * * There is a missing typedef for a function pointer data type. * * Make the change where the comment starts with "INSERT HERE" * * When it's correct, you can compile by gcc hw1.c */ #include  #include  #define MAXLENGTH 20 /* INSERT HERE: Missing typedef for "process_oper". It's a function pointer */ /* * Operations applied to the array * o sum_oper: sum the array * o max_oper: find the maximum * o min_oper: find the minimum */ int sum_oper(int a, int b) { return a+b; } int max_oper(int a, int b) { if (a > b) return a; else return b; } int min_oper(int a, int b) { if(a  

Problem 4. Find attached to this homework, find C language programs funcptr.c and pointer.c. (a) (1 pt) funcptr.c will print the sum of values in an array, as well as the maximum and minimum values. It uses function pointers. However, there is one typedef that needs to be written. It's a type for a function pointer. Make the correction so that the program compiles and will run correctly, displaying the sum, minimum and maximum. Be sure to write your name in the code as indicated. Upload your modified funcptr.c into laulima. You have to do some research on how to create the typedef, so you can google, e.g., http://www.learncpp.com/cpp-tutorial/78-function-pointers/ (b) (1 pt) pointer.c will print an array of integers and a character string. There are four functions - display_int: displays the integer array values - display_int_ptr: implements display_int but uses only pointers - display_char: displays a string of characters - display_char_ptr: implements display_char. Currently it uses an integer variable "i", so it is identical to display_char Modify display_char_ptr so it uses only pointers, just as display_int_ptr uses only pointers. Write your name in the code as indicated. Upload your modified pointer.c into laulima

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

Step: 3

blur-text-image

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

Practical Database Programming With Visual Basic.NET

Authors: Ying Bai

1st Edition

0521712351, 978-0521712354

More Books

Students also viewed these Databases questions

Question

3. Describe the communicative power of group affiliations

Answered: 1 week ago