CS2263/Labs/Lab2/lab2.c
2023-05-22 23:28:51 -03:00

27 lines
672 B
C

/* p1.c */
#include <stdio.h>
#include <stdlib.h>
int g1(int a, int b){
int c = (a + b) * b;
printf("g1: %d %d %d \n", a, b, c);
printf("a's address is %p, b's address is %p, c's address is %p\n", &a, &b, &c);
return c;
}
int g2(int a, int b){
int c = g1(a + 3, b - 11);
printf("g2: %d %d %d \n", a, b, c);
printf("a's address is %p, b's address is %p, c's address is %p\n", &a, &b, &c);
return c - b;
}
int main (int argc, char** argv){
int a = 5;
int b = 17;
int c = g2(a - 1, b * 2);
printf("main: %d %d %d \n", a, b, c);
printf("a's address is %p, b's address is %p, c's address is %p\n", &a, &b, &c);
return EXIT_SUCCESS;
}