What is array in c with example?



What is array in c with example?..

Answer / Narendra Singh Rajput

An array in C is a collection of variables of the same data type stored in contiguous memory locations. You can create an array by defining its name and specifying its size between square brackets (e.g., int arr[10]). Accessing elements within the array is done using indexes, where each element's index corresponds to its position in the array.nnHere's a simple example:nn```cnint arr[5] = { 1, 2, 3, 4, 5 }; /* initialize an array with 5 elements */narr[0]; /* access the first element (value: 1) */narr[2]; /* access the third element (value: 3) */n```

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

2. Write a function called hms_to_secs() that takes three int values—for hours, minutes, and seconds—as arguments, and returns the equivalent time in seconds.. Create a program that exercises this function by repeatedly obtaining a time value in hours, minutes, and seconds from the user (format 12:59:59), calling the function, and displaying the value of seconds it returns.

5 Answers   TCS,


Is there any data type in c with variable size?

1 Answers  


what is function pointer?

2 Answers   Wipro,


what is the code for getting the output as * ** ***

5 Answers   Caritor,


#define MAX(x,y) (x) >(y)?(x):(y) main() { inti=10,j=5,k=0; k= MAX(i++,++j); printf("%d..%d..%d",i,j,k); }

1 Answers   Wilco,


what does ‘segmentation violation’ mean?

1 Answers  


What is unary operator?

1 Answers  


code for selection sort?

1 Answers  


Which of the following operators is incorrect and why? ( >=, <=, <>, ==)

1 Answers  


Write a C program in Fibonacci series.

1 Answers   iNautix,


What kind of structure is a house?

1 Answers  


write a progam to display the factors of a given number and disply how many prime numbers are there?

2 Answers  


Categories