from ctypes import *
def swap(a, b):
t = a[0]
a[0] = b[0]
b[0] = t
x = c_int(1111)
y = c_int(2222)
print(x, y)
swap(pointer(x), pointer(y))
print(x, y)
from ctypes import *
def swap(a, b):
t = a[0]
a[0] = b[0]
b[0] = t
x = c_int(1111)
y = c_int(2222)
print(x, y)
swap(pointer(x), pointer(y))
print(x, y)
이게포인터임 ㅇㅅㅇ?
그럼 뭔데
걍스왑한거아님 ㅇㅅㅇ?
스왑이면 포인터 예제로 적당하지 뭘바람
신기방기하네