How do you initialize an array in C?a.int arr[3] = (1,2,3);b.int arr(3) = {1,2,3};c.int arr[3] = {1,2,3};d.int arr(3) = (1,2,3);
Question
Solution 1
The correct way to initialize an array in C is option c. Here's how you do it:
Declare the array with a specific size. In this case, the size is 3. So, you write
int arr[3]
.Initialize the array with specific values. In this case, the values are 1, 2, and 3. So, you write
= {1,2,3};
.Knowee AI StudyGPT is a powerful AI-powered study tool designed to help you to solve study prob
Knowee AI StudyGPT is a powerful AI-powered study tool designed to help you to solve study problem.
Knowee AI StudyGPT is a powerful AI-powered study tool designed to help you to solve study problem.
Knowee AI StudyGPT is a powerful AI-powered study tool designed to help you to solve study problem.
Knowee AI StudyGPT is a powerful AI-powered study tool designed to help you to solv
Similar Questions
How do you initialize an array in C?a.int arr[3] = (1,2,3);b.int arr(3) = {1,2,3};c.int arr[3] = {1,2,3};d.int arr(3) = (1,2,3);
Which is valid C expression?a.int my_num = 100,000;b.int my_num = 100000;c.int my num = 1000;d.int $my_num = 10000;
In C a pointer variable to an integer can be created by the decalarationa.int p*;b.int *p;c.int +p;d.int $p;
Which is a valid C variable declaration?Question 5Select one:a.int main;b.int $name;c.int age;d.int &temp;e.int name#;
How do you declare an array of integers in C?*1 pointint arr[10];array int[10];[10]int array;int array 10;