#include <stdio.h>

int a=2, b=2;

void p1(int c) {
    a=c;
    b=1;
}

void p2() {
    a=2;
    b=0;
}

void main() {
    int b;              //questo b è diverso da quello iniziale, è un altro int

    p1(3);              //a questo punto a=3 e b=1
    b=3;                //a questo punto a=3 e b=1
    p2();               //a questo punto a=2 e b=0
    printf("%d\n", a+b);          //sommo a=2 e b=3 (altra variabile) 
}

//se tolgo il p1 viene 5
//se tolgo b=3 esce 2 (derivati dal p2)
//se tolgo il p2 esce 6

Embed on website

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