How implement memory allocation with strings

Assignment Help Basic Computer Science
Reference no: EM13166696

how implement memory allocation with strings.

need to use a temporary variable to hold a string of

MAX_GENERATED_WORD_LENGTH characters which you will use to store the

string representing the word you are building. When this function returns, the temporary

variable should not be stored anymore in memory.

 

You will then iterate over the list of symbols provided to your function. This list is

implemented in an array named symbols of size nbSymbols. Each element of this array is

an int representing the atomic number of the element which symbol we want to use to spell a word.

The atomic numbers are to be used as parameter to the getElementSymbol function which will return the string representing this element's symbol.

 

These strings need to be concatenated to your temporary string in order to build the word represented

by the series of atomic numbers in the parameter symbols.

 

This is what I have so far:

 

char* elementsBuildWord(const int symbols[], int nbSymbols){

/* ROLE takes a list of elements' atomic numbers and allocate a new string made

of the symbols of each of these elements

PARAMETERS symbols an array of nbSymbols int which each represent the atomic number

of an element

nbSymbols symbols array's size

RETURN VALUE NULL if the array is of size <= 0

or if one of the symbols is not found by our getElementSymbol function

other the address of a newly allocated string representing the concatenation

of the names of all symbols

*/

 

if (nbSymbols <= 0){return NULL;}

if (!symbols) {return NULL;}

 

 

return NULL; // just here to let the project compile, implement your own version of this function

}

 

 

Reference no: EM13166696

Questions Cloud

Classes using set and get methods : Create a java program that contains two classes using set and get methods. I need the program to return the area and perimeter of a rectangle. I wrote a program and he returned to me saying I used the wrong constructors and didn't create a the sec..
Which element has the greatest density at stp : which element has the greatest density at STP? and why?
What is the mass in grams of the lead : The water level in a graduated cylinder initially at 217 rises to 286 after a piece of lead is submerged. What is the mass in grams of the lead?
How many times faster will the reaction occur : How many times faster will the reaction occur at 43^circ {rm C} than at 0 ^circ {rm C}? How many times faster will the reaction occur at 43^circ {rm C} than at 0 ^circ {rm C}?
How implement memory allocation with strings : how implement memory allocation with strings.
How many feet of copper can be obtained from the ingot : A copper refinery produces a copper ingot weighing 171 lb. If the copper is drawn into wire whose diameter is 8.25 mm, how many feet of copper can be obtained from the ingot?
Calculate the molar solubility of calcium carbonate : calculate the molar solubility of calcium carbonate in 0.050 molar calcium chloride and ksp for calcium chloride is 3.8X10^-9.
Explain how many grams of triethylmine were used : If you measure the pH and find it to be 11.24, how many grams of triethylmine were used to make the solution?
Calculate the minimum number of grams of c3h8(g) : Using information in Appendices B and C, calculate the minimum number of grams of C3H8(g) that must be combusted to provide the energy necessary to convert 3.25 kg of H2O from its solid form at -11.0°C to its liquid form at 70.0°C.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd