Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C programming For those questions which ask you to write a function, you do not need to create an entire program. 1. Write a

In C programming image text in transcribed
For those questions which ask you to write a function, you do not need to create an entire program. 1. Write a function called reverseO with this prototype: void reverse (int dest], int source[], int size); Your function should copy all the elements in the array source into the array dest, except in reverse order. The number of elements in the source array is give in the parameter size. Use a for loop to do the copying. Assume that dest is large enough to hold all of the elements 2. In class, we looked at the program on p. 29 of the text that finds and prints the longest line in the input. That program used a function called getline() to read a single line of input from the user. Rewrite the function getline() so that it uses a while loop instead of a for loop. 3. The C standard library contains a function strlen): int strlen (char s]); Strlen calculates and returns the size of the C-string s. (a) Write your own version of strlen() that has the same prototype. Assume that the parameter is a C-string (b) What will your function do if it is passed an array that is not a C-string? 4. Write a C function with the following prototype: int resize (char s, int array.size, int new.size); Your function should change the size of the C-string stored in the array s. If new.size is shorter than the current length of the string, truncate the string. If new.size is longer than the current length of the string, pad the end of the string with spaces, but don't exceed the size of the array, which is stored in array.size. Return the new size of the string as the value of the function

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

Oracle Database 10g Insider Solutions

Authors: Arun R. Kumar, John Kanagaraj, Richard Stroupe

1st Edition

0672327910, 978-0672327919

More Books

Students also viewed these Databases questions

Question

At what level(s) was this OD intervention scoped?

Answered: 1 week ago