SYSC 2006 Chapter 7: CHAP 7-ARRAYS(how to think like a computer scientist)

93 views3 pages

Document Summary

Array a named collection of values where all the values have the same type and each value is identified by an index. Arrays are helpful to store and process large sets of data. C allows us to initialize the values of an array immediately after you declare it. The values should be unclosed in curly brackets {}. int c[4]={1,2,3,4}; If we want to initialize the values later then that can be done only element by element. ++ adds one to the current value and -- subtracts one from the current value. The above statement is syntactically legal but it is wrong to write something like this. However it is correct to write index = index + 1; and index++; The indices starts at 0 and ends at (n-1) Never go beyond the boundaries of an array. C does not check array boundaries like java and can cause very severe bugs in the program.

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