Q1. (a) Explain what is meant by dynamic memory allocation. Why is this useful? Given that a
Fantastic news! We've Found the answer you've been seeking!
Question:
Q1. (a) Explain what is meant by dynamic memory allocation. Why is this useful? Given that a C program contains an integer variable called n, write a piece of C code which will dynamically allocate memory for an array called vec consisting of n elements of type int. (30%) (b) Explain what is meant by a preprocessor directive in C. What is the effect of the macro ide fine LINFUNC(x) How does the use of the macro LINFUNC (x) in a C program differ from the use of the function linfunc with definition int linfunc(int x) return (7x 1) (35%) (c) Explain clearly the operation of the following C program, detailing the effect of each line of the program. #include int main (void) int x[61 int *ptr: for (i-0;i5;i++)>
Posted Date: