47 lines
751 B
C
47 lines
751 B
C
void printf(char*, ...);
|
|
|
|
int fibonacci(int n) {
|
|
if (n < 2)
|
|
return 1;
|
|
return fibonacci(n - 1) + fibonacci(n - 2);
|
|
}
|
|
|
|
void change_first(char otus[5]) {
|
|
otus[0] = 115;
|
|
}
|
|
|
|
|
|
struct Otus;
|
|
|
|
void update(struct Otus potus) {
|
|
potus.field = 20;
|
|
}
|
|
struct Otus {
|
|
int field;
|
|
};
|
|
|
|
void update_ptr(char* ptr) {
|
|
*ptr = 50;
|
|
}
|
|
|
|
int main() {
|
|
char text[29] = "10th fibonacci number is %d!";
|
|
printf(text, fibonacci(10));
|
|
|
|
char somelist[5] = { 1, 2, 3, 4, 5 };
|
|
|
|
change_first(somelist);
|
|
|
|
printf(" first element: %d!", somelist[0]);
|
|
|
|
struct Otus otus = { 5 };
|
|
update(otus);
|
|
|
|
printf(" first field: %d!", otus.field);
|
|
|
|
char hello = 10;
|
|
update_ptr(&hello);
|
|
printf(" hello: %d!", hello);
|
|
|
|
return 0;
|
|
} |