0Pricing
Zig Academy · Ders

Sabit Boyutlu Diziler

Derleme zamanında boyutlandırılmış dizileri bildirin ve dizinleyin.

Sabit Boyutlu Diziler, CoddyKit'te ücretsiz bir Zig Academy dersidir. Bu, 4 dersinin 1. dersidir. Aşağıdan dersin tamamını ücretsiz okuyabilir, sonra tarayıcıda yerleşik kod editörü ve 7/24 yapay zeka koçu ile uygulamalı olarak pratik yapabilirsin. Bu, Zig Academy öğrenme yolunun bir parçasıdır ve ilerlemeniz web ve CoddyKit uygulaması arasında senkronize olur. Zig Academy kursu toplamda 4 dersten oluşur.

Bu dersin bazı bölümleri henüz çevrilmemiş olup İngilizce olarak gösterilmektedir.

What an Array Holds

An array stores a fixed number of values of the same type, laid out one after another in a single block of memory. 📦

The Length Is Fixed

In Zig the length is part of the array's type and is decided at compile time. It can never grow or shrink once declared.

Declaring an Array

You write the count in square brackets, then the element type. This [3]i32 holds exactly three signed integers.

const nums = [3]i32{ 10, 20, 30 };

Let Zig Count for You

Use an underscore for the size and Zig infers it from the values you list. Here [_]i32 becomes a three-element array.

const nums = [_]i32{ 1, 2, 3 };

Indexing Starts at Zero

Reach an element by its index in square brackets. Indices begin at 0, so nums[0] is the very first value.

const first = nums[0];

Asking for the Length

Every array exposes its size through the len field. It is known at compile time and never changes.

const count = nums.len; // 3

Bounds Are Checked

Reading past the end is caught for you. In safe builds an out-of-bounds index triggers a runtime panic instead of silent corruption.

Filling with One Value

Repeat a single element across the whole array using the ** operator. This makes five zeros without typing each one.

const zeros = [_]u8{0} ** 5;

Arrays Are Value Types

Assigning one array to another copies every element. The two arrays are independent, so changing one leaves the other untouched.

Mutating Elements

Declare the array with var to change elements later. Then assign through an index to update a single slot.

var scores = [_]i32{ 0, 0, 0 };
scores[1] = 99;

Arrays of Any Type

Elements can be any type, even other arrays. A [2][3]i32 is a small grid: two rows of three integers each.

const grid = [2][3]i32{ .{ 1, 2, 3 }, .{ 4, 5, 6 } };

Quick Check

You declared const nums = [_]i32{ 1, 2, 3 }. What does nums.len evaluate to?

Recap

A fixed-size array packs same-type values together: length is part of the type, indices start at 0, and access stays bounds-checked. 🎯

Sıkça Sorulan Sorular

“Sabit Boyutlu Diziler” dersi ücretsiz mi?

Evet — “Sabit Boyutlu Diziler” dersin tüm metni burada web'de ücretsiz olarak okunabilir. Etkileşimli olarak pratik yapmak (yerleşik kod editörü ve 7/24 yapay zeka koçu) ve Zig Academy kursunun geri kalanını açmak için CoddyKit PRO'ya yükselt. Zig Academy kursu toplamda 4 dersten oluşur.

“Sabit Boyutlu Diziler” dersinde ne öğreneceğim?

Derleme zamanında boyutlandırılmış dizileri bildirin ve dizinleyin. Zig Academy ile uygulamalı kodu tarayıcıda doğrudan çalıştırarak pratik yaparsın ve 7/24 yapay zeka koçu dersi çalışırken sorularını yanıtlar.

Zig Academy öğrenmeye başlamak için deneyim gerekli mi?

Önceden deneyim gerekmez. CoddyKit'te Zig Academy, başlangıçtan ileri seviyeye kadar yapılandırıldığı için buradan başlayabilir veya başından başlayıp kendi hızında ilerleme yapabilirsin. Bu, 4 dersinin 1. dersidir.

“Sabit Boyutlu Diziler” dersi ne kadar sürer?

Çoğu CoddyKit dersi yaklaşık 5–10 dakika sürer. Her biri kısa ve etkileşimli olduğu için sabit ilerleme yaparsın ve web ile uygulama arasında tam olarak bıraktığın yerden devam edebilirsin.

Bu Zig Academy dersinde kod yazıp çalıştırabilir miyim?

Evet. Her Zig Academy dersi yerleşik bir kod editörü içerir, bu sayede tarayıcıda gerçek kod yazıp çalıştırabilir ve anlık yapay zeka geri bildirimi alırsın — yerel kurulum gerekli değildir.

Bu kursun tüm dersleri

  1. Sabit Boyutlu Diziler
  2. Dilimler: Bir İşaretçi ve Uzunluk
  3. array[start..end] ile Dilimleme
  4. Dilimler Üzerinde Yineleme ve Değişiklik Yapma
← Zig Academy Sayfasına Dön