1
0
mirror of https://github.com/adambard/learnxinyminutes-docs.git synced 2025-08-07 15:26:45 +02:00

some updates turkish translation for latest updates of forked repo

This commit is contained in:
Haydar Kulekci
2013-08-19 14:41:44 +03:00
parent dbf05283fc
commit f6b7d0b2c0

View File

@@ -24,11 +24,16 @@ anlarsanız sizi isteğiniz yere götürecektir.
Çoklu satırlı yorumlar bu şekilde görünür.
*/
// #include ile header dosyalarınız dahil edin.
// C Standart kütüphanelerini uygulamanıza #include<ornek.h> ile
// dahil edebilirsiniz.
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
// Kendi başlık(header) dosyalarınız dahil etmek için "çift tırnak"
// kullanmalısınız.
#include "my_header.h"
// Fonksiyonlarınızı bir .h dosyasında ya da c dosyanızın üst tarafta
// tanımlayın.
@@ -84,7 +89,15 @@ unsigned long long ux_long_long;
// cinsinden boyutunu verir öyle ki bu tipin boyutunu taşınabilir bir
// şekilde ifade edilebilir
// Örneğin,
printf("%lu\n", sizeof(int)); // => 4 (on machines with 4-byte words)
printf("%lu\n", sizeof(int)); // => 4 (bir çok makinede 4-byte words)
// If the argument of the `sizeof` operator an expression, then its argument
// is not evaluated (except VLAs (see below)).
// The value it yields in this case is a compile-time constant.
int a = 1;
size_t size = sizeof(a++); // a++ is not evaluated
printf("sizeof(a++) = %zu where a = %d\n", size, a);
// prints "sizeof(a++) = 4 where a = 1" (on a 32-bit architecture)
// Diziler somut bir boyut ile oluşturulmalıdır.
char my_char_array[20]; // Bu dizi 1 * 20 = 20 byte alan kaplar
@@ -102,6 +115,22 @@ my_array[0]; // => 0
my_array[1] = 2;
printf("%d\n", my_array[1]); // => 2
// In C99 (and as an optional feature in C11), variable-length arrays (VLAs)
// can be declared as well. The size of such an array need not be a compile
// time constant:
printf("Enter the array size: "); // ask the user for an array size
char buf[0x100];
fgets(buf, sizeof buf, stdin);
// strtoul parses a string to an unsigned integer
size_t size = strtoul(buf, NULL, 10);
int var_length_array[size]; // declare the VLA
printf("sizeof array = %zu\n", sizeof var_length_array);
// A possible outcome of this program may be:
// > Enter the array size: 10
// > sizeof array = 40
// String'ler bir NUL (0x00) byte ile sonlandırılmış karakter dizileridir,
// bu string içerisinde özel bir karakter olan '\0' ile gösterilir.
// (Biz Nul byte'i string karakterleri arasında bulundurmamıza gerek
@@ -116,6 +145,12 @@ a_string 16 karakter uzunluğundadır.
*/
printf("%d\n", a_string[16]); // => 0
// i.e., byte #17 is 0 (as are 18, 19, and 20)
// If we have characters between single quotes, that's a character literal.
// It's of type `int`, and *not* `char` (for historical reasons).
int cha = 'a'; // fine
char chb = 'a'; // fine too (implicit conversion from int to char)
///////////////////////////////////////
// Operatörler
@@ -162,6 +197,12 @@ f1 / f2; // => 0.5, artı veya eksi epsilon
0x01 << 1; // => 0x02 (bitwise left shift (by 1))
0x02 >> 1; // => 0x01 (bitwise right shift (by 1))
// Be careful when shifting signed integers - the following are undefined:
// - shifting into the sign bit of a signed integer (int a = 1 << 32)
// - left-shifting a negative number (int a = -1 << 2)
// - shifting by an offset which is >= the width of the type of the LHS:
// int a = 1 << 32; // UB if int is 32 bits wide
///////////////////////////////////////
// Kontrol Yapıları
///////////////////////////////////////
@@ -213,7 +254,11 @@ printf("%d\n", (short) x_hex); // => Prints 1
printf("%d\n", (char) x_hex); // => Prints 1
// Tip hiçbir hata vermeden taşacaktır(overflow).
printf("%d\n", (char) 257); // => 1 (Max char = 255)
printf("%d\n", (unsigned char) 257); // => 1 (Max char = 255 eğer karakter 8 bit uzunluğunda ise)
// `char`, `signed char` ve `unsigned char` karakter tiplerinin maksimum uzunluğunu
// belirlemek için <limits.h> kütüphanesindeki CHAR_MAX, SCHAR_MAX ve UCHAR_MAX
// macrolarını kullanınız.
// Integral tipi kayan noktalı yazı tipine dönüştürülecektir ve tam tersi.
printf("%f\n", (float)100); // %f formats a float
@@ -265,6 +310,18 @@ int* x_ptr = x_array;
// x_ptr artık dizinin ilk elemanını işaret etmektedir (the integer 20).
// Bu çalışacaktır çünkü diziler(arrays) aslında sadece onların ilk
// elemanlarını gösteren birer işaretçidir.
// For example, when an array is passed to a function or is assigned to a pointer,
// it decays into (implicitly converted to) a pointer.
// Exceptions: when the array is the argument of the `&` (address-od) operator:
int arr[10];
int (*ptr_to_arr)[10] = &arr; // &arr is NOT of type `int *`!
// It's of type "pointer to array" (of ten `int`s).
// or when the array is a string literal used for initializing a char array:
char arr[] = "foobarbazquirk";
// or when it's the argument of the `sizeof` or `alignof` operator:
int arr[10];
int *ptr = arr; // equivalent with int *ptr = &arr[0];
printf("%zu %zu\n", sizeof arr, sizeof ptr); // probably prints "40, 4" or "40, 8"
// Diziler ilk elemanlarını gösteren birer işaretçidirler.
printf("%d\n", *(x_ptr)); // => 20 yazılacaktır.
@@ -349,6 +406,10 @@ struct rectangle {
int height;
};
// It's not generally true that
// sizeof(struct rectangle) == sizeof(int) + sizeof(int)
// due to potential padding between the structure members (this is for alignment
// reasons). [1]
void function_1(){
@@ -414,4 +475,10 @@ typedef void (*my_fnp_type)(char *);
Diğer bir iyi kaynak ise [Learn C the hard way](http://c.learncodethehardway.org/book/)
It's very important to use proper spacing, indentation and to be consistent with your coding style in general.
Readable code is better than clever code and fast code. For a good, sane coding style to adopt, see the
[Linux kernel coding stlye](https://www.kernel.org/doc/Documentation/CodingStyle).
Diğer taraftan google sizin için bir arkadaş olabilir.
[1] http://stackoverflow.com/questions/119123/why-isnt-sizeof-for-a-struct-equal-to-the-sum-of-sizeof-of-each-member