Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I always get error of this question, can someone give me some hints? void free_strings(char **strings); The function accepts an array of zero or more

I always get error of this question, can someone give me some hints? void free_strings(char **strings); 

The function accepts an array of zero or more strings that has a NULL in the last location. It frees all memory allocated for the array for strings.

Here is an example of some code that would create such an array, using the function copy_string from the page Allocating Strings:

 array = (char **)calloc(6, sizeof(char *)); array[0] = copy_string("dog"); array[1] = copy_string("cat"); array[2] = copy_string("llama"); array[3] = copy_string("mule"); array[4] = copy_string("fish"); 

Here is a complete starter file including the header file you will need to include. stringarray.h does include both string.h and stdio.h so you do not have to include those.

#include "freestrings.h" void free_strings(char **strings) { } 

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

Expert Oracle Database Architecture

Authors: Thomas Kyte, Darl Kuhn

3rd Edition

1430262990, 9781430262992

More Books

Students also viewed these Databases questions