Question

In: Computer Science

Which of the following is a valid C statement? Explain what each valid statement does. For invalid statements, explain the problem.

 
Which of the following is a valid C statement? Explain what each valid statement does. For invalid statements, explain the problem.
 a. int items [5];
 b. int items [];
 c. int items = {3, 7,2 };
 d. int items [] = {3, 7, 2};
 e. int items [3] = {3, 7,2};

 

Solutions

Expert Solution

Below is the answer to your question 1

a) int items [5] :- Here items is a variable which can hold upto 5 numbers.

b) int items [ ] :- This is not a valid statement as initialization of an array is not done nor the number has been specified as to what extent can array hold the numbers.

c) int items = {3,7,2} :- Invalid statement as we are trying to assign a number variable with different values at a time. A single value assignment would have worked

int item = 3 or in case of array int items[] = {3,7,2} would have sufficed.

d) int items[] = {3,7,2} :- This will create an array of integers with name items which will have 3 values.

e) int items[] = {3,7,2} :- This will create an array of integers with name items which will have 3 values


Related Solutions

What is the difference between a valid and an invalid complaint? Give an example of each....
What is the difference between a valid and an invalid complaint? Give an example of each. What is the difference in how these are treated from a customer service standpoint?
Determine each of the following arguments’ forms to be valid or invalid. You may use the...
Determine each of the following arguments’ forms to be valid or invalid. You may use the Venn Diagram proof method, the rules/fallacies method, or any other method, of your choice. 1. Some athletes are not baseball players and some baseball players are not basketball players. Therefore, some athletes are not basketball players.2. All creationists are fundamentalists because all fundamentalists are religious people and all creationists are religious people. 3. As no conservationists are litterers, no environmentalists are litterers, because all...
Which of the following statements are true? Which are false? Explain (for each statement) According to...
Which of the following statements are true? Which are false? Explain (for each statement) According to the Phillips curve, in the long run there is a trade-off between inflation and unemployment Phillips curve represents a structural relationship between unemployment and inflation that never changes. Unemployment rate counts all people who do not have jobs.
Translate the following into standard form and symbolic form. Is it a valid or invalid argument?...
Translate the following into standard form and symbolic form. Is it a valid or invalid argument? Sound or unsound? Why? "Science and religion are basically the same. In religion, you believe something based purely upon faith. But in science, even if there is evidence, you have to have faith in your experiments and in the scientific method."" critical thinking a concise guide 4th edition, its not showing up on chegg study
List the four financial statements and explain each one. What does each statement tell us?
  List the four financial statements and explain each one. What does each statement tell us? Provide an example of each statement using a corporation. Next, explain the connections between the financial statements.  
Which of the following statements is true? a. It is possible that the APT is valid...
Which of the following statements is true? a. It is possible that the APT is valid and the CAPM is not. True False b. It is possible that the CAPM is valid and the APT is not. True False
List the four financial statements and explain each one. What does each statement tell us? Provide...
List the four financial statements and explain each one. What does each statement tell us? Provide an example of each statement using the corporation you researched in Week 1 (Wal-Mart). Next, explain the connections between the financial statements.
List the four financial statements and explain each one. What does each statement tell us? Provide...
List the four financial statements and explain each one. What does each statement tell us? Provide an example of each statement using the corporation like Publix Super Market. Next, explain the connections between the financial statements.
Indicate which of the following are valid C++ variable names and which are not. If not,...
Indicate which of the following are valid C++ variable names and which are not. If not, state the reason the name is invalid. Variable Name Valid – Yes/No If Invalid – Reason income 2time int Tom's two fold c3po income#1 item
Which of the following statements regarding prospecting theory is true? Explain why each statement is correct...
Which of the following statements regarding prospecting theory is true? Explain why each statement is correct or incorrect. a. Certainty is given low weight relative to near-certainty. b. Prospect theory weights are exactly the same as the probabilities used in Expected Utility Theory. c. The weighting function for losses can differ from the weighting function for gains. d. A gains adds more to utility than an equal-sized loss subtracts from it.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT