Skip to content

Instantly share code, notes, and snippets.

@zindmax
Last active December 23, 2021 18:28
Show Gist options
  • Save zindmax/fcd5a13ff48d326fe5580fa20648b4f4 to your computer and use it in GitHub Desktop.
Save zindmax/fcd5a13ff48d326fe5580fa20648b4f4 to your computer and use it in GitHub Desktop.
lab_7
def myfunc1():
x = "John"
def myfunc2():
nonlocal x
x = "hello"
myfunc2()
return x
print(myfunc1())
#include <iostream>
using namespace std;
void dswap(double *x, double *y) {
double t=*x;
*x=*y;
*y=t;
}
int main() {
double x=1.5, y=3.4;
dswap(&x, &y);
cout << x << " " << y;
return 0;
}
#include <iostream>
using namespace std;
int rec(int x) {
return rec(x+1);
}
int main() {
cout << rec(1);
return 0;
}
class A {
static int x = 1;
}
public class Main
{
public static void main(String[] args) {
A a_1 = new A();
A a_2 = new A();
System.out.println(a_1.x + " " + a_2.x);
A.x = 10;
System.out.println(a_1.x + " " + a_2.x);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment