COMP1721 - Higher Computing 1B

Computing 1B - Week 13 Tutorial Questions

  1. Implement this C program in AVR assembler.

    Explain how it uses the stack.

    
    #include <stdio.h>
    
    int fib(int i) {
        int j, k;
        if (i < 2)
            return 1;
        j = fib(i - 1);
        k = fib(i - 2);
        return j + k;
    }
    
    int main(void) {
    	printf("%d\n", fib(10)); 
        return 0;
    }
    


Andrew Taylor (andrewt@cse.unsw.edu.au)
Higher Computing 1B, Computer Science & Engineering, UNSW