Basic C Arrays

May 8th, 2015
Studypool Tutor
Price: $10 USD

Tutor description

The main memory of a computer can be thought as a huge array of memory loca9ons. •â€¯ Each basic memory loca9on consumes 1 BYTE. •â€¯ E.g. The 1GB of main memory can be thought as an array with 1,073,741,824 elements, each element = 1 BYTE.

Word Count: 571
Showing Page: 1/9
Researh PaperCArrays:1D&2DENGG1002ComputerProgrammingand Applica9ons Dr.HaydenKwokHaySo Week1BasicCArrays Declara9on:datatype ofeachelementint anarray[5];variable namesize Ini9aliza9on(op9onal) Accessinganelement int anarray[5] = {2,3,5,7,11}; Remember:C/C++arraysstartcoun9ngfrom0! Validforindexesfrom0tosize1 anarray[0] = 31;anarray[i+3] = anarray[4]+7; Whathappenswhenyouaccessanarray[6]?ArrayvsMemory Themainmemoryofacomputercanbethoughtasahuge arrayofmemoryloca9ons. Eachbasicmemoryloca9onconsumes1BYTE. E.g.The1GBofmainmemorycanbethoughtasanarraywith 1,073,741,824elements,eachelement=1BYTE. InC/C++,anarrayisacon(nuousblockofmemory. 1,073,741,823 1,073,741,822 u o i e a 1 0 char vowels[5]={a,e,i,o,u};1bytesvowelsArrayofIntegersint primes[3]={11,13,17};108 107 106 105 104 103 102 101 100 1 04bytesprimes Q:Ifprimesisstoredatloca9on 100,thenhowcanyound primes[1], primes[2]? A:primes[1]storedatloca9on 100+4=104 primes

Review from student

Studypool Student
" Wow this is really good.... didn't expect it. Sweet!!!! "
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1820 tutors are online

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors