Good luck <3
*&int *int_pointer;&my_variable;*int_pointer;{ }, a stack frame is createdint main(void) {
int user_age = 20;
int array[5] = {1, 2, 3, 4, 5};
return 0;
}

int add_two_ints(int a, int b) {
int sum = a + b;
return sum;
}
int main(void) {
int new_int = add_two_ints(1, 4);
retrun 0;
}


C provides us some functions to interact with the heap.
malloc()malloc -> Memory Allocation (allocate memory on the heap)mallocptr = (cast-type*) malloc(byte-size)#include <stdio.h>
int main(void) {
malloc(1000);
malloc(sizeof(int));
malloc(sizeof(char) * 50);
return 0;
}
A common way of using malloc is to create dynamic arrays:
int main(void) {
int num_elements;
scanf("%d", num_elements);
int *data = malloc(num_elements * sizeof(int));
return 0;
}
freeint *data = malloc(num_elements * sizeof(int));
...
free(data);
reallocreallocint *data = malloc(num_elements * sizeof(int));
num_elements += 40;
data = realloc(data, num_elements * sizeof(int));
...
free(data);
