Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

ALL ANSERS RELATE TO C PROGRAMS WRITTEN IN LINUX OS Which of the following are true about dynamic memory and structs? Select one or more:

ALL ANSERS RELATE TO C PROGRAMS WRITTEN IN LINUX OS

image text in transcribed

image text in transcribed

Which of the following are true about dynamic memory and structs? Select one or more: a. To dynamically request sufficient memory for a string containing the message "Hello FIT2100", we can use the following line of code: char *message = (char *) malloc(sizeof(char) * 13); b. For a dynamically created 2D array, we can call free() on its previously malloc()'d pointers in any order. c. A struct is essentially a group of several variables, functions and/or methods of potentially varying data types that are all under a same name. d. For a program that allows the user to enter a string where the length of this string varies based on the user's previous inputs, dynamic memory should be used. e. Members of a struct can either be accessed via dot notation, or the arrow operator if accessing them via pointers. Which of the following are true about pointers and strings? Select one or more: a. To obtain the fifth character in a char array variable called my_string, we can use the following line of code: char fifth_char = *(my_string + 5); b. The process of obtaining the value stored at a memory address pointed to by a pointer is called referencing and can be done with the * operator. c. Pointers are special variables that store a reference to another variable in the form of a memory address. d. The following code allows us to validly obtain the memory address of an integer my_int, and store it in an integer pointer the_address: int my_int = 0; int* the_address = &my_int; e. A pointer to a variable can be passed to a function to allow us to retain the changes made by the function to the actual value of that variable, even after returning from said function

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

Professional Visual Basic 6 Databases

Authors: Charles Williams

1st Edition

1861002025, 978-1861002020

More Books

Students also viewed these Databases questions

Question

Indicate some sources that contain a dividend record of payments.

Answered: 1 week ago

Question

State the uses of job description.

Answered: 1 week ago

Question

Explain in detail the different methods of performance appraisal .

Answered: 1 week ago

Question

What is DDL?

Answered: 1 week ago