Sayfa 26'ya kadar olanlar işlendi
This commit is contained in:
parent
a691d9687a
commit
79cea78298
28
ChangeLog
28
ChangeLog
@ -1,3 +1,31 @@
|
||||
2024-02-19 Mert Gör <mertgor@masscollabs.xyz>
|
||||
|
||||
* c-basic/global-local-variables.c: global and local variable scopes exmplained
|
||||
|
||||
* c-basic/void.function.c: void fonksiyonlarda return kullanılmamışsa fonksiyon ana blok sonlanınca sonlanır.
|
||||
|
||||
* c-basic/return.2.c: return 0; /* bu olmasaydı da aynı anlam oluşacaktı */
|
||||
|
||||
* c-basic/return.c: return explained
|
||||
|
||||
* c-basic/abc-double.c: İsmi a, b, c olan double türden 3 değişken tanımlayınız. Sonra a ve b için klavyeden scaf fonksiyonuyla okuma
|
||||
yapınız. Bu ikisinin toplamını c'ye atayınız ve c'yi yazdırınız.
|
||||
|
||||
* c-basic/float-and-double.c: printf fonksiyonunda hem float hem de double türleri %f ile yazdırılır. Ancak scanf fonksiyonunda float %f ile,
|
||||
double %lf ile okunur.
|
||||
|
||||
* c-basic/scanf-example.hex.c: scanf ile %x ile okumak istersek klavyeden yaptığımız girişin 16'lık sistemde olduğu kabul edilir.
|
||||
|
||||
* c-basic/scanf-example.2.c: scanf example 2
|
||||
|
||||
* c-basic/scanf-example.c: scanf example explained
|
||||
|
||||
* c-basic/printf-examples.c: printf examples explained
|
||||
|
||||
* c-basic/foo.c: Foo example : C'de iç içe fonksiyon tanımlanamaz. Her fonksiyon diğerinin dışında tanımlanmak zorundadır.
|
||||
|
||||
* c-basic/hello.c: hello world example
|
||||
|
||||
2024-02-14 Mert Gör <mertgor@masscollabs.xyz>
|
||||
|
||||
* c-basic/C.pdf: CSD Derneği C temel notu tekrar C-Basic klasörüne eklendi ancak hwpplayer1 dalı için eklendi. Örnekler özgün olarak yeniden yazılacak.
|
||||
|
18
c-basic/abc-double.c
Normal file
18
c-basic/abc-double.c
Normal file
@ -0,0 +1,18 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
double a, b, c;
|
||||
|
||||
printf("a degerini giriniz :");
|
||||
scanf("%lf", &a);
|
||||
|
||||
printf("b degerini giriniz :");
|
||||
scanf("%lf", &b);
|
||||
|
||||
c = a + b;
|
||||
|
||||
printf("c = %f\n", c);
|
||||
|
||||
return 0;
|
||||
}
|
16
c-basic/float-and-double.c
Normal file
16
c-basic/float-and-double.c
Normal file
@ -0,0 +1,16 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(){
|
||||
float f;
|
||||
double d;
|
||||
|
||||
printf("float bir deger giriniz:");
|
||||
scanf("%f", &f);
|
||||
|
||||
printf("double bir deger giriniz: ");
|
||||
scanf("%lf", &d);
|
||||
|
||||
printf("f = %f, d = %f\n", f, d);
|
||||
|
||||
return 0;
|
||||
}
|
9
c-basic/foo.c
Normal file
9
c-basic/foo.c
Normal file
@ -0,0 +1,9 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int foo(){
|
||||
printf("I am foo\n");
|
||||
}
|
||||
|
||||
int main(){
|
||||
foo();
|
||||
}
|
26
c-basic/global-local-variables.c
Normal file
26
c-basic/global-local-variables.c
Normal file
@ -0,0 +1,26 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(){
|
||||
int a;
|
||||
|
||||
{
|
||||
int b;
|
||||
|
||||
b = 20;
|
||||
a = 10;
|
||||
|
||||
printf("a = %d, b = %d\n", a, b); // correct
|
||||
}
|
||||
|
||||
printf("a = %d\n", a); // correct
|
||||
// printf("b = %d\n", b); // error
|
||||
/**
|
||||
* hwpplayer1@hwpplayer1-Aspire-A315-24P:~/Projects/hwpplayer1/c-course/c-basic$ gcc global-local-variables.c
|
||||
global-local-variables.c: In function ‘main’:
|
||||
global-local-variables.c:16:24: error: ‘b’ undeclared (first use in this function)
|
||||
16 | printf("b = %d\n", b); // error
|
||||
| ^
|
||||
global-local-variables.c:16:24: note: each undeclared identifier is reported only once for each function it appears in
|
||||
*
|
||||
*/
|
||||
}
|
6
c-basic/hello.c
Normal file
6
c-basic/hello.c
Normal file
@ -0,0 +1,6 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(){
|
||||
printf("Hello World !...\n");
|
||||
return 0;
|
||||
}
|
12
c-basic/printf-examples.c
Normal file
12
c-basic/printf-examples.c
Normal file
@ -0,0 +1,12 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(){
|
||||
int a = 10;
|
||||
int b = 20;
|
||||
|
||||
printf("a = %d, b = %d\n", a, b);
|
||||
printf("a = %d, b = %d\n", b, a);
|
||||
printf("%d%d\n",a,b);
|
||||
|
||||
return 0;
|
||||
}
|
7
c-basic/return.2.c
Normal file
7
c-basic/return.2.c
Normal file
@ -0,0 +1,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(){
|
||||
printf("I am main\n");
|
||||
|
||||
return 0; // with our without same result will be executed
|
||||
}
|
19
c-basic/return.c
Normal file
19
c-basic/return.c
Normal file
@ -0,0 +1,19 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int foo(){
|
||||
printf("Foo\n");
|
||||
|
||||
return 100;
|
||||
|
||||
printf("test\n"); /* unreachable code! */
|
||||
}
|
||||
|
||||
int main(){
|
||||
int result;
|
||||
|
||||
result = foo() * 2;
|
||||
|
||||
printf("%d\n", result);
|
||||
|
||||
return 0;
|
||||
}
|
12
c-basic/scanf-example.2.c
Normal file
12
c-basic/scanf-example.2.c
Normal file
@ -0,0 +1,12 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(){
|
||||
int a;
|
||||
int b;
|
||||
|
||||
printf("Iki sayi giriniz: ");
|
||||
scanf("%d%d", &a, &b);
|
||||
printf("a = %d, b = %d\n", a, b);
|
||||
|
||||
return 0;
|
||||
}
|
11
c-basic/scanf-example.c
Normal file
11
c-basic/scanf-example.c
Normal file
@ -0,0 +1,11 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(){
|
||||
int a;
|
||||
|
||||
printf("sayi giriniz : ");
|
||||
scanf("%d", &a);
|
||||
printf("Girilen deger : %d\n", a);
|
||||
|
||||
return 0;
|
||||
}
|
11
c-basic/scanf-example.hex.c
Normal file
11
c-basic/scanf-example.hex.c
Normal file
@ -0,0 +1,11 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(){
|
||||
int a, b;
|
||||
|
||||
printf("Bir sayi giriniz: ");
|
||||
scanf("%x", &a);
|
||||
printf("a = %d\n", a);
|
||||
|
||||
return 0;
|
||||
}
|
13
c-basic/void.function.c
Normal file
13
c-basic/void.function.c
Normal file
@ -0,0 +1,13 @@
|
||||
#include <stdio.h>
|
||||
|
||||
void foo(){
|
||||
printf("foo\n");
|
||||
}
|
||||
|
||||
int main(){
|
||||
printf("I am main\n");
|
||||
|
||||
foo();
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user