Özyinelemeli Fonksiyonlar ve Dizi Güncelleme

SonsuzUs Her şey › Category: Soru › Özyinelemeli Fonksiyonlar ve Dizi Güncelleme
sonsuz Kurucu sordu 1 hafta önce
void f(int s, int z, int a[]) {
    if (s >= z) {
        a[s] = 1;
    } else {
        f(s + 1, z, a);
        a[s] = a[s] * a[s + 1];
    }
}

int main() {
    int a[] = {5, 2, 2};
    f(0, 2, a);
    int t = 0;
    for (int i = 0; i < 3; i++)
        t += a[i];
    printf("%i\n", t);
}

Yukarıdaki programın ekran çıktısı nedir?

Cevapla