交换两个变量值(未交换)

Run Settings
LanguageC
Language Version
Run Command
#include <stdio.h> void swap2Variable(int a, int b) { printf("a is %d,b is %d\n", a, b); int temp; temp = a; a = b; b = temp; printf("a is %d,b is %d\n", a, b); } int main() { int num1 = 3, num2 = 5; printf("before swap: num1 is %d, num2 is %d\n", num1, num2); swap2Variable(num1, num2); printf("after swap: num1 is %d, num2 is %d\n", num1, num2); // 函数执行完成后,结果没有变化 }
Editor Settings
Theme
Key bindings
Full width
Lines