Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MakeShip() has the following function prototype: strict battleship makeShip (int. size, int pos); Input parameters: makeShip() takes as input the size and position of the

image text in transcribed
MakeShip() has the following function prototype: strict battleship makeShip (int. size, int pos); Input parameters: makeShip() takes as input the size and position of the ship. Return type: makeShip() returns a battleship structure. Functionality: makeShip() defines and initializes a battleship structure. It sets the battleship's member variables size and post based on its input parameters; it allocates a contiguous block of memory that is large enough to hold size integers and sets the member variable body to point to the start of the block: it assigns 1 to every element of body, which can be treated as an array with size elements after it has been allocated memory; and, finally, it returns the initialized battleship structure variable. Testing: Use the main source file test_1.c to test the functionality of makeShip(). Study this source file carefully since it will teach you how to (i) work with the battleship structure and (ii) write your own simple code to test functions

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

Database Management Systems Designing And Building Business Applications

Authors: Gerald V. Post

1st Edition

0072898933, 978-0072898934

More Books

Students also viewed these Databases questions

Question

A rating instrument linked to job duties and responsibilities

Answered: 1 week ago

Question

What is Change Control and how does it operate?

Answered: 1 week ago

Question

How do Data Requirements relate to Functional Requirements?

Answered: 1 week ago