C++ pointers , just short answers only dont need to do complete code, this is 1
ID: 3890912 • Letter: C
Question
C++ pointers , just short answers only dont need to do complete code, this is 1 comlete problem,
1. Pointr Syntax: Basic pointer question SHORT ANSWER ONLY
A. Writ th dclaration of a doubl pointr namd avrag
B. Writ th dclaration of a doubl pointr namd avr and assign nullptr to it
C. Dynamically allocat mmory for a DNA objct and stor its addrss in a variabl namd dnaPtr
D. Dclar a on-dimnsional array of 30 doubls (on th stack) namd rainfall
E. Dclar and allocat mmory (on th hap) for a on-dimnsional array of 256 doubls namd prics
F. Dclar a two-dimnsional array of doubls (on th stack) namd tickrValus with 12 rows and 31 columns
G. Dclar and allocat mmory (on th hap) for a two-dimnsional array of strings namd carMaks with 20 rows, ach with 6 columns
H. Giv th dclaration for a function assignPictur() that taks a pointr to a HugStudntRcord objct
I. Giv th dclaration for a function calculatAvrag() that taks an array of doubls and an int namd count
J.Writ a call to function calculatAvrag(), passing it rainfall
Explanation / Answer
Answers:
A)double *average; //double pointer
B)double *aver=NULL;
C) DNA *object,*dnaPtr;
object = new DNA; // uses default constructor
dnaPtr=&object; //stores DNA object in danPtr variable
D) double rainfall[30]; //allocates memory on stack
E)double *prices;
prices = new double[256]; //allocates memory on heap
F)double tickerValues[12][31]; //allocates memory on stack
G)string *carMakes;
carMakes = new string[20][6]; //allocates memory on heap
I)double calculateAverage(double array[],int count);
J)calculateAverage(a,count);
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.