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

  Remember to make only one step at a time

Prove the following. Remember to make only one step at a time and not skip steps. Remember to write what rule allowed you to make each step, and which lines you applied it to

  1.what is the value of the following instruction?

1.What is the value of the following instruction? mov al,01101011b shr al,22.What is the two's complement of the binary number 11010000?3.Which statement defines an array local variable consisting 40 signed words?

  Important ideas for legislators to get from your testimony

Suppose the legislature in your state is debating the adoption of UCITA. What are the three most important ideas you want your legislators to get from your testimony?

  Find a recurrence relation for the number

Find a recurrence relation for the number of bit strings that contain the string 01 . what are the initial condition , and how many bit strings of length seven contain the string 01. please explain it fully step by step to better undestand

  Describe how will tsp work

How will TSP work? Transit planners require to ask questions like: First step is to assess requirement for TSP There are a variety of methods for conducting Needs Assessment.

  Multiplexors whose control bit allows

Multiplexors whose control bit allows you to select between one of two modes right shift or left shift. Include logic to perform arithmetic shift left and arithmetic shift right . This means you must include logic to perform sign extension in ..

  Decision tables and dependency diagrams

Decision Tables and Dependency Diagrams

  Sentinel-controlled repetition to allow a user

The computeShippingCharges() method should use sentinel-controlled repetition to allow a user to enter shipping data until the user has indicated that he or she is done. The total shipping charges will be computed and returned as a double value.

  Given a set of integer numbers

Given a set of integer numbers as int A[ ] = { 12, 6, 51, 4, 3, 7, 19, 8, 0, 21}, please write down the divide and conquer procedure of quick sort (step by step), include all left and right positions adjustment, and overwriting.

  Compute the mips rating for processor

Determine the average CPI? On a 500MHz Pentium III program takes 1 second. Compute the MIPS rating for this processor? Determine the CPI?

  Write statement which outputs num-cost to standard output

Write single statement which outputs num and cost to standard output. Print both values (num first, then cost), separated by a space on a single line.

  Describe the concept of form follows function

Describe the concept of "Form Follows Function" as it pertains to the three main areas of design (FAB). Recognize ways in which portfolio designer works within limitations of media technology (Functionality).

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