אלמוני פלוני3
New member
שלום לכולם - שאלה ב - c אשמח לעזרה
יש לי את התכנית הבאה : #include <stdio.h> #include <conio.h> int x = 3; void a (int x) { x = 5; printf ("\n\rThe value of x is: %d", x); } void b (int* x) { (*x)++; printf ("\n\rThe value of *x is: %d", *x); } void c() { x= x+2; printf ("\n\rThe value of x is: %d", x); } void main() { printf ("\n\rThe value of x is: %d", x); a (x); printf ("\n\rThe value of x after function a is: %d", x); b (&x); printf ("\n\rThe value of x after function b is: %d", x); { int x = 1; c(); printf ("\n\rThe value of x after function c is: %d", x); } } אני אשמח מאוד לדעת מהו הפתרון בכל שלב ואם אפשר עם נימוק זה ממש יעזור לי . לגבי ה - x האחרון : יש הטוענים שהוא שווה ל -1 אבל אני לא יודע אם זה נכון וגם אם כן למה ? תודה רבה לפותרים
יש לי את התכנית הבאה : #include <stdio.h> #include <conio.h> int x = 3; void a (int x) { x = 5; printf ("\n\rThe value of x is: %d", x); } void b (int* x) { (*x)++; printf ("\n\rThe value of *x is: %d", *x); } void c() { x= x+2; printf ("\n\rThe value of x is: %d", x); } void main() { printf ("\n\rThe value of x is: %d", x); a (x); printf ("\n\rThe value of x after function a is: %d", x); b (&x); printf ("\n\rThe value of x after function b is: %d", x); { int x = 1; c(); printf ("\n\rThe value of x after function c is: %d", x); } } אני אשמח מאוד לדעת מהו הפתרון בכל שלב ואם אפשר עם נימוק זה ממש יעזור לי . לגבי ה - x האחרון : יש הטוענים שהוא שווה ל -1 אבל אני לא יודע אם זה נכון וגם אם כן למה ? תודה רבה לפותרים