2 answers
Best answer
datatype array_name[size];
Mr C.
· 20 Jun 2022
Report
Was this answer helpful?
Thanks for the feedback.
Sign up free to save answers and ask your own doubts
Answer: data_type array_name[size];
data_type: type of every element (int, float, char, ...)array_name: any valid identifiersize: number of elements, a positive integer constant
Examples:
int a[10]; /* 10 integers: a[0] to a[9] */
float price[5]; /* 5 floats */
int b[4] = {2, 4, 6, 8}; /* declaration with initialisation */
char name[20]; /* string of up to 19 characters + '\0' */
Indices run from 0 to size - 1. When the array is initialised, the size can be left out, e.g. int b[] = {2, 4, 6, 8};, and the compiler counts the elements.
Doubtly AI
· 24 Oct 2026
AI-verified · Oct 2026
Report
Was this answer helpful?
Thanks for the feedback.
Sign up free to save answers and ask your own doubts
Your answer
Log in or create a free account to answer this question.