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

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
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
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.
Determine whether the following categorical syllogisms are valid or invalid. Categorical syllogism 1 No M are...
Determine whether the following categorical syllogisms are valid or invalid. Categorical syllogism 1 No M are P. No M are S No S are P. Categorical syllogism 2 Some M are not P. Some M are S. Some S are not P. Categorical syllogism 3 Some M are not P. Some M are not S. Some S are P. Categorical syllogism 4 All M are P. All S are M. All S are P. Categorical syllogism 6 No M are...
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.
For each of the following statements, decide if the statement is true or false and explain...
For each of the following statements, decide if the statement is true or false and explain why: A) If Jane buys a brand new 2016 car in 2017, 2017 GDP does not change. B) The CPI is a better indicator of the price level than the GDP deflator C) If workers at a customer service call center in Durham, NC get laid-off because their company has moved the call center to India; this is an example of cyclical unemployment. D)...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT