본문 바로가기

자료구조

Jagged Array (가변배열)

//이현진
//2021-09-13

using System;
using System.Collections.Generic;

namespace HelloWorld
{
    public class App
    {
        //생성자
        public App()
        {
            //int[][] jaggedArr = new int[3][];
            //int[] arr1 = new int[2];
            //jaggedArr[0] = arr1;

            //int[] arr2 = new int[5];
            //for (int i = 0; i < arr2.Length; i++)
            //{
            //    arr2[i] = i + 1;
            //}

            //jaggedArr[1] = arr2;

            //int[] arr3 = new int[3];
            //for (int i = 0; i < arr3.Length; i++)
            //{
            //    arr3[i] = i + 6;
            //}
            //jaggedArr[2] = arr3;

            //Item[] arr = new Item[3];
            //Item item = new Item();
            //item.name = "장검";
            //arr[0] = item;

            //int[] arr = new int[3];
            //int[] arr2 = arr;
            //arr2[2] = 100;
        }
    }
}

 

 

'자료구조' 카테고리의 다른 글

동적배열의 축소  (0) 2021.12.28
동적 배열 (Dynamic Array)  (0) 2021.12.28
Dictionary + 인벤토리  (0) 2021.12.26
데이터 테이블 과 Dictionary (아이템, 몬스터) 수정중  (0) 2021.12.25
큐 연습 문제 (카드)  (0) 2021.12.25