This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
void add(int a, int b) { | |
a = a + b; | |
} | |
int main(void) { | |
int a = 7; | |
add(a, 10) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(void) { | |
// this is a register variable. | |
register int a = 10, i; | |
for (i = 0; i < a; i++) { | |
printf("%d", i); | |
} | |
system("pause"); | |
return 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
void addValue() { | |
// It doesn't reset every time I call. | |
static int a = 10; | |
a = a + 10; | |
printf("%d\n", a); | |
} | |
int main(void) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
void addValue() { | |
// It doesn't reset every time I call. | |
static int a = 10; | |
a = a + 10; | |
printf("%d\n", a); | |
} | |
int main(void) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(void) { | |
//this is a local variable. | |
int a = 10; | |
if (1) { | |
int a = 3 | |
} | |
printf("%d", a); | |
system("pause"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
// this is a global variable. | |
int a = 1; | |
// Can be used within a function without declaration. | |
void changeValue() { | |
a = 5 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class Animal { | |
SwimmingBehavior swimmingBehavior; | |
SoundBehavior soundBehavior; | |
public abstarct void display(); | |
public void performSwimming() { | |
swimmingBehavior.swim(); | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def example_code(list_of_product_data): | |
return { | |
index: product for index, product in enumberate(list_of_product_data) | |
if prodcut == 'specific_kind' | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def example_code(list_of_product_data): | |
kinds = {} | |
for index, product in enumerate(list_of_product_data): | |
if product == 'specific_kind': | |
kinds[index] = product | |
return kinds |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def example_code(list_of_product_data): | |
kinds = [] | |
for product in list_of_product_data: | |
if product == 'specific_kind': | |
kinds.append(product) | |
return kinds |