Summary

This document details a lecture on arrays in the Programmeringsteknik DT143G course at Örebro University, focusing on static arrays, loops and homogenous data structures. The lecturer is Pascal Rebreyend, and the lecture date is Nov 26, 2024.

Full Transcript

Introduction Programmeringsteknik DT143G Lecture 7: Arrays (static) Pascal Rebreyend 26-11-2024 Pascal Rebreyend Programmeringsteknik DT143G Introduction Today’s contents Static Arrays Loops, revisited homogen...

Introduction Programmeringsteknik DT143G Lecture 7: Arrays (static) Pascal Rebreyend 26-11-2024 Pascal Rebreyend Programmeringsteknik DT143G Introduction Today’s contents Static Arrays Loops, revisited homogenous data-structures Pascal Rebreyend Programmeringsteknik DT143G Introduction variables and data Variables store: local and temporary information during computations data/information used as input or along the program Problem with variables: Store only one value Not suitable to handle big volume of data, sound, video,... ) Pascal Rebreyend Programmeringsteknik DT143G Introduction data-structure data-structure: How we store data and have connections between the different data. An important field of programming Example: Arrays, matrices,... files have a structure too Later we will see other structures Pascal Rebreyend Programmeringsteknik DT143G Introduction Arrays Array: 1-dimension structure All elements have the same type (float,integer,... ) In short, just a new datatype based on previous one we access directly each element (they are of the basic type). Each element has an index (0 for the first one) #include int main() { int a; a=4; printf("%d\n",a); return 0; } Pascal Rebreyend Programmeringsteknik DT143G Introduction Arrays and loops Loops are naturally useful with arrays! #include int main() { int a,i; for (i=0;i

Use Quizgecko on...
Browser
Browser