Question 20 Consider the following code. What best describes the overall purpose
ID: 3707564 • Letter: Q
Question
Question 20 Consider the following code. What best describes the overall purpose of the function myFunction? typedef struct char name[100 int ID ) Student Student myFunction(int n) Student x (Student "1 malloc(sizeof(Student) n) memset(x,0,sizeof(Student) n) return x; Dynamically allocate exactly 100 students and return the pointer to the memory. Dynamically allocate an array of students, based on the input, and return the pointer to the memory. Set an array of students that was passed by reference to 0 O Free a previous memory allocation of an array of studentsExplanation / Answer
Question 20:
b
return x statement says that x is pointer address of the memory and it creates dynamically at run of the program. it creates array of element based on the input n.
Question 21:
Effective size(b)
maximum size of array in c means maximum no of elemnts it can store in array.
Effective size of array means no of it actually stored at run time of program
malloc is used to create array size at run time.
From definition of parallel Arrays implicit data structure that uses multiple arrays to represent a singular array of records.
Question 22:
A file(c)
A file is stored in the computer it saves the data even when program is closed. where as byte,heap,stack clears or destroy the data when program is closed
Question 23:
strlen(d)
strlen is predefined function in string.h library to define length of the string.
Question 24:
'e' (option b)
mstring points address of first char H.
mstring[1] contains value e which assign to x.
so x print 'e'
Question 25:
parallel Arrays (a)
From definition of parallel Arrays implicit data structure that uses multiple arrays to represent a singular array of records.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.