Pointers and References Problems
Pointers & Memory (C / C++)
Section titled “Pointers & Memory (C / C++)”Swap Using Pointers
Section titled “Swap Using Pointers”void swap(int *a, int *b) { int temp = *a; *a = *b; *b = temp;}Dynamic Array Allocation
Section titled “Dynamic Array Allocation”void handleArray() { int n; scanf("%d", &n); int* arr = (int*)malloc(n * sizeof(int)); for(int i = 0; i < n; i++) scanf("%d", &arr[i]); free(arr);}