Main Page
Assignment 01
Assignment 02
Assignment 03
Assignment 04
Assignment 05
Assignment 06
Assignment 07
Assignment 08
Assignment 09
Assignment 10
Assignment 11
Assignment 12
Assignment 13
Coding rules
(pdf)
Sample code
Prob: Set 1
Prob: Set 2
Compiler options
Submission
Forum
Teaching Assistants
Links
Trivia
|
Assignment 4
Demonstrate seperate pointer-based functions (for 4a-4d) and references-based functions (for 4a and 4b only) that:
a. Swap two numbers.
b. Return the sum of two numbers.
c. Find if the 2-D arrays are being stored in row-major or column-major order using (c1) pointers, and (c2) values stored.
d. Access directly a value in an array for given the indices i , j without using A[i][j] but using the information from 4(c).
e. Find the memory locations and values of all the variables (including pointers) used in the main() and in the calling functions used in 4a & 4b.
f. Implement Fibonacci function that prints the values of n, (n-1) and
(n-2) (when necessary). Use a simple shell script
(not more than five lines!) to process the
output and use graphviz to
trace the calls made so that they can be visualized as shown
here with circo or
here with dot.
PS: The program should be coded in both C and C++.
|