#include <unistd.h>
#include <stdio.h>

void    ft_swap(int *a, int *b) 
{
        int     temp;
        temp = *a; 
        *a = *b; 
        *b = temp;
}

int main(void)
{
    int *ptr1;
    int *ptr2;
    int i = 1;
    int j = 2;

    ptr1 = &i;
    ptr2 = &j;

    printf("before: %d, %d\n", *ptr1, *ptr2);
    ft_swap(ptr1, ptr2);
    printf("after: %d, %d", *ptr1, *ptr2);
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: