* example program to demonstrate the passing of an array */ #include int maximum( int [] ); /* ANSI...
-
Upload
lawrence-marshall -
Category
Documents
-
view
234 -
download
0
Transcript of * example program to demonstrate the passing of an array */ #include int maximum( int [] ); /* ANSI...
![Page 1: * example program to demonstrate the passing of an array */ #include int maximum( int [] ); /* ANSI function prototype */ int maximum(](https://reader038.fdocuments.net/reader038/viewer/2022102911/5697c0261a28abf838cd5be3/html5/thumbnails/1.jpg)
Create program that uses
Arrays
Create program that uses Arrays
![Page 2: * example program to demonstrate the passing of an array */ #include int maximum( int [] ); /* ANSI function prototype */ int maximum(](https://reader038.fdocuments.net/reader038/viewer/2022102911/5697c0261a28abf838cd5be3/html5/thumbnails/2.jpg)
ContentsPre Test
Introducing Arrays
Defining and Initializing Arrays
Passing Arrays to Function
Post Test
![Page 3: * example program to demonstrate the passing of an array */ #include int maximum( int [] ); /* ANSI function prototype */ int maximum(](https://reader038.fdocuments.net/reader038/viewer/2022102911/5697c0261a28abf838cd5be3/html5/thumbnails/3.jpg)
Pre Test
![Page 4: * example program to demonstrate the passing of an array */ #include int maximum( int [] ); /* ANSI function prototype */ int maximum(](https://reader038.fdocuments.net/reader038/viewer/2022102911/5697c0261a28abf838cd5be3/html5/thumbnails/4.jpg)
It is the programming language
a. URLb. C ++
c.Notepadd.Browser
also known as vector or multidimensional languages
a. Pointersb. Characters
c. Arrayd. Strings
![Page 5: * example program to demonstrate the passing of an array */ #include int maximum( int [] ); /* ANSI function prototype */ int maximum(](https://reader038.fdocuments.net/reader038/viewer/2022102911/5697c0261a28abf838cd5be3/html5/thumbnails/5.jpg)
Two types of Array
a. One dimension and multi-dimension array
Programming language
a. Notepad b. URL
b. Wattpad and Notepad
c. Browserd. C ++
![Page 6: * example program to demonstrate the passing of an array */ #include int maximum( int [] ); /* ANSI function prototype */ int maximum(](https://reader038.fdocuments.net/reader038/viewer/2022102911/5697c0261a28abf838cd5be3/html5/thumbnails/6.jpg)
What is Array ?An array is a series of elements of the same type placed in contiguous memory locations that can be individually referenced by adding an index to a unique identifier.
What is Array ?
An array is a series of elements of the same type placed in contiguous memory locations that can be individually referenced by adding an index to a unique identifier.
![Page 7: * example program to demonstrate the passing of an array */ #include int maximum( int [] ); /* ANSI function prototype */ int maximum(](https://reader038.fdocuments.net/reader038/viewer/2022102911/5697c0261a28abf838cd5be3/html5/thumbnails/7.jpg)
Defining and Initializing Arrays When declaring a regular array of local scope (within a function, for example), if we do not specify otherwise, its elements will not be initialized to any value by default, so their content will be undetermined until we store some value in them. The elements of global and static arrays, on the other hand, are automatically initialized with their default values, which for all fundamental types this means they are filled with zeros
![Page 8: * example program to demonstrate the passing of an array */ #include int maximum( int [] ); /* ANSI function prototype */ int maximum(](https://reader038.fdocuments.net/reader038/viewer/2022102911/5697c0261a28abf838cd5be3/html5/thumbnails/8.jpg)
Multidimensional Array
Multidimensional arrays can be described as "arrays of arrays". For example, a bidimensional array can be imagined as a bidimensional table made of elements, all of them of a same uniform data type.
![Page 9: * example program to demonstrate the passing of an array */ #include int maximum( int [] ); /* ANSI function prototype */ int maximum(](https://reader038.fdocuments.net/reader038/viewer/2022102911/5697c0261a28abf838cd5be3/html5/thumbnails/9.jpg)
One Dimensional Array
A one-dimensional array is a structured collection of components (often called array elements) that can be accessed individually by specifying the position of a component with a single index value.
![Page 10: * example program to demonstrate the passing of an array */ #include int maximum( int [] ); /* ANSI function prototype */ int maximum(](https://reader038.fdocuments.net/reader038/viewer/2022102911/5697c0261a28abf838cd5be3/html5/thumbnails/10.jpg)
Passing Arrays to Function
![Page 11: * example program to demonstrate the passing of an array */ #include int maximum( int [] ); /* ANSI function prototype */ int maximum(](https://reader038.fdocuments.net/reader038/viewer/2022102911/5697c0261a28abf838cd5be3/html5/thumbnails/11.jpg)
/* example program to demonstrate the passing of an array */#include <stdio.h>int maximum( int [] ); /* ANSI function prototype */
int maximum( int values[5] ){
int max_value, i;
max_value = values[0];for( i = 0; i < 5; ++i )
if( values[i] > max_value )max_value = values[i];
return max_value;}
main(){
int values[5], i, max;
printf("Enter 5 numbers\n");for( i = 0; i < 5; ++i )
scanf("%d", &values[i] );
max = maximum( values );printf("\nMaximum value is %d\n", max );
![Page 12: * example program to demonstrate the passing of an array */ #include int maximum( int [] ); /* ANSI function prototype */ int maximum(](https://reader038.fdocuments.net/reader038/viewer/2022102911/5697c0261a28abf838cd5be3/html5/thumbnails/12.jpg)
Post Test
![Page 13: * example program to demonstrate the passing of an array */ #include int maximum( int [] ); /* ANSI function prototype */ int maximum(](https://reader038.fdocuments.net/reader038/viewer/2022102911/5697c0261a28abf838cd5be3/html5/thumbnails/13.jpg)
It is the programming language
a. URLb. C ++
c.Notepadd.Browser
also known as vector or multidimensional languages
a. Pointersb. Characters
c. Arrayd. Strings
![Page 14: * example program to demonstrate the passing of an array */ #include int maximum( int [] ); /* ANSI function prototype */ int maximum(](https://reader038.fdocuments.net/reader038/viewer/2022102911/5697c0261a28abf838cd5be3/html5/thumbnails/14.jpg)
Two types of Array
a. One dimension and multi-dimension array
Programming language
a. Notepad b. URL
b. Wattpad and Notepad
c. Browserd. C ++
![Page 15: * example program to demonstrate the passing of an array */ #include int maximum( int [] ); /* ANSI function prototype */ int maximum(](https://reader038.fdocuments.net/reader038/viewer/2022102911/5697c0261a28abf838cd5be3/html5/thumbnails/15.jpg)
References
http://www.cplusplus.com/doc/tutorial/arrays
http://www.learncpp.com/cpp-tutorial/65-
multidimensional-arrays/
http://www.google.com.ph
![Page 16: * example program to demonstrate the passing of an array */ #include int maximum( int [] ); /* ANSI function prototype */ int maximum(](https://reader038.fdocuments.net/reader038/viewer/2022102911/5697c0261a28abf838cd5be3/html5/thumbnails/16.jpg)
Acknowledgement
I would like to thank my friends for
supporting me beyond my needs.
![Page 17: * example program to demonstrate the passing of an array */ #include int maximum( int [] ); /* ANSI function prototype */ int maximum(](https://reader038.fdocuments.net/reader038/viewer/2022102911/5697c0261a28abf838cd5be3/html5/thumbnails/17.jpg)
Special thanks to:
Mr. John RelubaMy Classmatesand ME !!!Copy Right 2012
![Page 18: * example program to demonstrate the passing of an array */ #include int maximum( int [] ); /* ANSI function prototype */ int maximum(](https://reader038.fdocuments.net/reader038/viewer/2022102911/5697c0261a28abf838cd5be3/html5/thumbnails/18.jpg)
![Page 19: * example program to demonstrate the passing of an array */ #include int maximum( int [] ); /* ANSI function prototype */ int maximum(](https://reader038.fdocuments.net/reader038/viewer/2022102911/5697c0261a28abf838cd5be3/html5/thumbnails/19.jpg)
![Page 20: * example program to demonstrate the passing of an array */ #include int maximum( int [] ); /* ANSI function prototype */ int maximum(](https://reader038.fdocuments.net/reader038/viewer/2022102911/5697c0261a28abf838cd5be3/html5/thumbnails/20.jpg)
Sorry…Back
![Page 21: * example program to demonstrate the passing of an array */ #include int maximum( int [] ); /* ANSI function prototype */ int maximum(](https://reader038.fdocuments.net/reader038/viewer/2022102911/5697c0261a28abf838cd5be3/html5/thumbnails/21.jpg)
Sorry…Back
![Page 22: * example program to demonstrate the passing of an array */ #include int maximum( int [] ); /* ANSI function prototype */ int maximum(](https://reader038.fdocuments.net/reader038/viewer/2022102911/5697c0261a28abf838cd5be3/html5/thumbnails/22.jpg)
Your HOT !!!BackCorrec
t
![Page 23: * example program to demonstrate the passing of an array */ #include int maximum( int [] ); /* ANSI function prototype */ int maximum(](https://reader038.fdocuments.net/reader038/viewer/2022102911/5697c0261a28abf838cd5be3/html5/thumbnails/23.jpg)
Your HOT !!!BackCorrec
t