Pointers and Memory Allocation in C
Added on 2020-02-18
2 Pages448 Words58 Views
|
|
|
1.a) mp has its own allocated memory space independent of m and n.c) The program should display m=2 n=3 *mp = 2 *np = 3d) mp points to me) np points to n2.e) in line 07 – the programmer can write an arithmetic operation which contains the variable.3.a) in line 07 – the programmer can write an arithmetic operation which contains the variable.b) in line 03 – the programmer can write a logical expression for the if – statement, which contains the variable.c) in line 11 – the programmer can write an arithmetic operation which contains the variable.d) in line 13 – the programmer can write an arithmetic operation which contains the variable.4.a) To get to a specific node in a linked list, the program needs to travel through the listsequentially. d) Fundamental data type used to build a linked list is a pointer to a structure, which contains at least one pointer to another structure of the same type.5.b) printf("%d \n", *(xp+1)); and printf("%d \n", xp[1); would print the same valuec) printf("%d \n", *xp)); would print 10 as the output.d) printf("%d \n", *(xp+1)); would print 5 as the output.6.a) A function can have any number of inputs, however a function can output only one value through return keyword.b) The key functions that allow dynamic memory allocation/deallocation through pointers is provided by stdlib.hd) An integer is a variable that contains a whole number.e) consider an array defined as int arr[10]; The variable arr is in fact a pointer.7.d) The malloc, calloc, realloc functions allocate memory to a pointer that is not necessarily contiguous.8.e) fun(&d, d);9.a) a variable that stores an integerb) the memory location of the variable.d) a variable that stores the memory location of an integer.e) the integer value stored in the memory locationc) the memory location of the beginning of the array.
![Pointers and Memory Allocation in C_1](/_next/image/?url=https%3A%2F%2Fdesklib.com%2Fmedia%2Fimages%2Fpv%2F856f59578cfc4d28bf89267e2eb99e0b.jpg&w=3840&q=10)
End of preview
Want to access all the pages? Upload your documents or become a member.
Related Documents