CIS 1500 Lecture 24: 20161201 - Lecture 24

41 views4 pages

Document Summary

Suppose we have the following string declaration: char str[5]; which string below can be correctly assigned to the variable str: yavin, alderaan, hoth (this one is correct, tatooine. How do you copy the contents of the string text into the string text2? char text[50]; char text2[100]; strcpy(text2, text); Initialize all the 10 elements of an int array named rainfall to zero. for (i =0; i < 10; ++i) rainfall[i] = 0; Functions are useful for: modularization, avoiding code repetition, to allow certain information to be hidden decoupling functionality from implementation. A recursive function is a function that: calls itself. Fib[1] = 1; for (i =2; i <= 50; i=i+1) What type of logic error exists in the code: a syntax error, declaration of fib as an int instead of a long long. 3. the loop index should have an initial value of zero. 4. the array will go out of bounds (this is the problem)

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents