Array is one of the most basic Data Structure.
Data Structure is logical or physical relationshop between data.
Or more simply, Data structure is way to save data in computer to use it effectively.
Array is a compliation of element (that holds data) in linear shape.
For example,
int a[6];

To call thrid element in this Array.. we can use index.
a[2]
it will return 10 as an element.
In C language we can initate data type of the array like int a[6]; means that the array only takes integers as their element.
We can also initialize it like.
int a[6] = {10, 9, 8, 7, 6, 5}
This means a[0] becomes 10 and a[1] becomes 9 accordingly.
To get the size of array we can use sizeof function in C.
sizeof(a) // returns 6 in this case.
sizeof(a[0]) //returns memeory size of a[0]
'Computer Science > Algorithm and Data structure with C' 카테고리의 다른 글
| Leetcode #78 Subse (0) | 2023.05.29 |
|---|---|
| Chapter 1. Basic C and Algorithm (0) | 2023.02.16 |