Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,3 @@
if(a=b){} //assigns to "a" the value of "b". Then, if "a" is nonzero, the code in the curly braces is run.
if(a==b){} //runs the code in the curly braces if and only if the value of "a" equals the value of "b".

View file

@ -0,0 +1,7 @@
int main()
{
int x = 3;
int y = 5;
int z = 7;
printf("%d %d %d %x %x",x,y,z); //on an Intel cpu the first %x reveals %%ebp and the second reveals the return address.)
}

View file

@ -0,0 +1 @@
int foo[4] = {4,8,12,16};

View file

@ -0,0 +1,4 @@
int foo[4] = {4,8,12,16};
int x = foo[0]; //x = 4
int y = foo[3]; //y = 16
int z = foo[4]; //z = ?????????

View file

@ -0,0 +1,5 @@
int foo()
{
char bar[20];
return sizeof(bar);
}

View file

@ -0,0 +1,7 @@
int foo()
{
#define size_of_bar 20 //the sizeof operator is the same as doing this essentially.
char bar[size_of_bar];
return size_of_bar;
}

View file

@ -0,0 +1,4 @@
int gotcha(char bar[])
{
return sizeof(bar);
}

View file

@ -0,0 +1,2 @@
myArray[40];
int x = gotcha(myArray);

View file

@ -0,0 +1,2 @@
myArray[40];
int x = gotcha(&myArray[0]);

View file

@ -0,0 +1,7 @@
int foo(char buf[],int length){}
int main()
{
char myArray[30];
int j = foo(myArray,sizeof(myArray)); //passes 30 as the length parameter.
}