DEV Community 👩‍💻👨‍💻

Cover image for Arrays Basics
Romil Jain
Romil Jain

Posted on

Arrays Basics

In Arrays, we can store multiple items of the same type together.

int A[5]; → means that we have declared an array of size 5
when we count arrays we count from zero , so here count is represented by index.

count arrays

A[0]=14; → means we have stored 14 at index 0
A[1]=2; → means we have stored 2 at index 1

We can declare above array easily by using code blocks
int A[10]={3,5,6,7,8,9}; → this is called declaration + assigning the value

I would recommend you to study C language from GeekForGeeks and learn about structures

HINT :- To print all array values


for(int i=0;i<5;i++){
  printf("%d", A[i];
};

Enter fullscreen mode Exit fullscreen mode

Top comments (2)

Collapse
 
lukeshiru profile image
Luke Shiru

Romil, the idea with the tags in posts is to hint the topics of the post itself, your code snippet is in C, so you shouldn't have #webdev and #javascript as tags. Consider removing those tags and maybe using "ansic" or something similar.

Thanks!

🌚 Browsing with dark mode makes you a better developer by a factor of exactly 40.

It's a scientific fact.