Question

Which of the following is a valid array initialization? Group of answer choices int array[2] =...

Which of the following is a valid array initialization?

Group of answer choices

int array[2] = [3, 4];

int array[10];

None of the others

int array[] = {1, 39};

int array(2) = {5, 10};

Homework Answers

Answer #1

int array[10]; and int array[] = {1, 39}; are the valid array initialization.

If you use the first one for array initialization then you will get an error message stating that the expected expression was different. C only accepts the values of the array in {} parenthesis.

similarly, if we use () for declaring the length of the array than an expectation error will shown stating expected declaration specifiers were not valid.

Thus, int array[2] = [3, 4]; and int array(2) = {5, 10}; are invalid array initialization in C programming.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Which of the following is a valid initialization for the variable size when declaring the following...
Which of the following is a valid initialization for the variable size when declaring the following array: int test_array[size]; Group of answer choices int size = 12; double size = 12; const int size = 12; int size = 0;
Consider the following array: int[] a = { 3, 5, 2, 2, 4, 7, 0, 8,...
Consider the following array: int[] a = { 3, 5, 2, 2, 4, 7, 0, 8, 9, 4 }; What are the contents of the array a after the following loops complete? (show how you arrive at the answer) a) for (int i = 1; i < 10; i++) { a[i] = a[i - 1]; b) for (int i = 9; i > 0; i--) { a[i] = a[i - 1]; }
1) How many significant figure are in the number 0.00150? Group of answer Choices: 5 2...
1) How many significant figure are in the number 0.00150? Group of answer Choices: 5 2 3 4 2) If the calculation 12.1202 - 0.10 is performed, what is the answer to the correct number of significant figures? Group of answer choices: 12.0202 12.02 12 12.0 3) Which measurement does not represent the same length as the others? Group of answer choices: 0.01 kilometers 10 meters 1000 centimeters 100 millimeters 4) Lead has a density of 11.34 g/cm3. If one...
2. Which of the following is a tactic to alleviate excess demand? Group of answer choices...
2. Which of the following is a tactic to alleviate excess demand? Group of answer choices 1. Reducing the price of the good. 2. Renting the factory space to local clubs. 3. Offering a sales promotion. 4. Increasing the price of the good. 5. All of the above are ways to alleviate excess demand.
1.) Which of the following could be a legitimate probability distribution? Group of answer choices X...
1.) Which of the following could be a legitimate probability distribution? Group of answer choices X 0.3 0.7 P(X) - 0.5 1.5 X - 4 1.5 10 P(X) - 0.6 0.1 0.3 X 1 2 3 P(X) 0.4 0.3 0.2 X - 1 -2 - 3 P(X) 1.2 0.6 0.3 None of the above are legitimate probability distributions.
Write a c++ function which takes two parameters: an array of ints and an int size...
Write a c++ function which takes two parameters: an array of ints and an int size of the array and prints every element greater than 5 to the screen. You may assume that the parameters passed to the function are valid. Your function must have the following signature: void printSome(const int array[], int size);
int i,sum=0;   int array[8]={//You decide this};   int *a,*b,*c;   a = array;   b = &array[3];   c =...
int i,sum=0;   int array[8]={//You decide this};   int *a,*b,*c;   a = array;   b = &array[3];   c = &array[5];   c[-1] = 2;   array[1] = b[1]-1;   *(c+1) = (b[-1]=5) + 2;   sum += *(a+2) + *(b+2) + *(c+2);   printf("%d %d %d %d\n", sum, array[b-a], array[c-a], *a-*b); array[8]={ ?? }; what is array[8]?
Which is an invalid access for the vector? vector<int> numsList(5); int x = 3; Group of...
Which is an invalid access for the vector? vector<int> numsList(5); int x = 3; Group of answer choices numsList.at(x+2) numsList.at(x-3) numsList.at((2*x) - x) numsList.at(0) Program: C++ Single choice
1-Which of the following organisms possess a closed circulatory system? Group of answer choices 1-penguin 2-lung...
1-Which of the following organisms possess a closed circulatory system? Group of answer choices 1-penguin 2-lung fish 3-octopus 4-All of these possess a closed circulatory system earthworm Question 2 2-What do Poriferans lack that excludes them from the Eumetazoa? 1-Group of answer choices 2-true tissues 3-a complete digestive tract 4-an open circulatory system nerves
Complete following function which receives an array of integers and the length of the array, and...
Complete following function which receives an array of integers and the length of the array, and then returns the sum of all the positive numbers in the array. For example, if an array that is passed to this function contains following numbers: -1, 2, 0, 3, 4, -3, 0, 2, 0, and then the return value of the function should be 11. Will this function be working correctly? Yes or No? int sumPositive(int a[],int length) { int s=0;     for(int...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT