/* example program to demonstrate the passing of an array */ #include int maximum( int [] ); /* ANSI function prototype */ int maximum(

Slides:



Advertisements
Similar presentations
For(int i = 1; i
Advertisements

Part 1 Landscape Hannu Laine. Pointer parameters //prototype of swap void swap(int *a, int *b); //application void main(void) { in number1 = 1, number2.
Functions Prototypes, parameter passing, return values, activation frams.
Templates in C++. Generic Programming Programming/developing algorithms with the abstraction of types The uses of the abstract type define the necessary.
Review What is a virtual function? What can be achieved with virtual functions? How to define a pure virtual function? What is an abstract class? Can a.
Introduction to C Programming CE Lecture 18 Dynamic Memory Allocation and Ragged Arrays.
1 Array Knowledge Understand the execute technique of array Skill Can write application program using one and two dimensional array.
1 More on pointers. Example 1 – pass by value/reference int main(){ int p, q, r; p = 5; q = 6; r = Sum_1(p, q + 1); return 0; } void Sum_1(int a, int.
1 Passing Array Array’s element can be passed individually to a function; copying value exist during passing process. An entire array can be passed to.
Parameter Passing to Functions in C. C Parameter passing Review of by-value/by-reference.
Functions Pass by Value Pass by Reference IC 210.
Презентація за розділом “Гумористичні твори”
Центр атестації педагогічних працівників 2014
Галактики і квазари.
Характеристика ІНДІЇ.
Процюк Н.В. вчитель початкових класів Боярської ЗОШ І – ІІІ ст №4
Pointers Example Use int main() { int *x; int y; int z; y = 10; x = &y; y = 11; *x = 12; z = 15; x = &z; *x = 5; z = 8; printf(“%d %d %d\n”, *x, y, z);
Computer Science 210 Computer Organization Pointers.
1 Software John Sum Institute of Technology Management National Chung Hsing University.
Programming Arrays. Example 1 Write a program that reads 3 numbers from the user and print them in reverse order. How many variables do we need to store.
C Functions Programmer-defined functions – Functions written by the programmer to define specific tasks. Functions are invoked by a function call. The.
Computer Science 210 Computer Organization Arrays.
Chapter 11: Pointers Copyright © 2008 W. W. Norton & Company. All rights reserved. 1 Chapter 11 Pointers.
Problem Solving and Program Design in C (5th Edition) by Jeri R. Hanly and Elliot B. Koffman Chapter 6 (Pointers) © CPCS
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee C Language Part 3.
Духовні символи Голосіївського району
Lecture 15: Projects Using Similar Data. What is an Array? An array is a data structure consisting of related data items of the same type. Stored in a.
FUNCTION Dong-Chul Kim BioMeCIS UTA 12/7/
Definition of function Types of Function Built-in User Defined Catagories of Function No argument No return value Argument but No return value No argument.
How to design and code functions Chapter 4 (ctd).
Introduction to Computer Organization & Systems Topics: C arrays C pointers COMP Spring 2014 C Part IV.
UniMAP Sem2-09/10 DKT121:Fundamental of Computer Programming1 Functions (2)
CCSA 221 Programming in C CHAPTER 7 WORKING WITH ARRAYS 1.
Chapter 8 Arrays. A First Book of ANSI C, Fourth Edition2 Introduction Atomic variable: variable whose value cannot be further subdivided into a built-in.
Principle Prog Revision. Question 1 (a) Identify errors in the following program segment and how the errors can be corrected. void main(){ constant int.
While loop Write a program that asks the user to enter a number, then displays whether this number is even or odd. The program repeats until the user quits.
CSCI 161 Lecture 14 Martin van Bommel. New Structure Recall “average.cpp” program –Read in a list of numbers –Count them and sum them up –Calculate the.
6. LOOPS. Example: Summing a Series of Numbers #include int main(void) { int n, sum = 0; printf("This program sums a series of numbers.\n"); printf("Enter.
Recursion repetition without loops. Recursion  definition solving a problem in terms of a smaller version of itself  form of a recursive solution: base.
Arrays Name, Index, Address. Arrays – Declaration and Initialization int x; y[0] y[1] y[2]
DKT121:Fundamental of Computer Programming
Functions in C Mrs. Chitra M. Gaikwad.
מבוא כללי למדעי המחשב תרגול 2
Pointers (continued) Chapter 11
Проф. д-р Васил Цанов, Институт за икономически изследвания при БАН
ЗУТ ПРОЕКТ на Закон за изменение и допълнение на ЗУТ
О Б Щ И Н А С И Л И С Т Р А П р о е к т Б ю д ж е т г.
Електронни услуги на НАП
Боряна Георгиева – директор на
РАЙОНЕН СЪД - БУРГАС РАБОТНА СРЕЩА СЪС СЪДЕБНИТЕ ЗАСЕДАТЕЛИ ПРИ РАЙОНЕН СЪД – БУРГАС 21 ОКТОМВРИ 2016 г.
Сътрудничество между полицията и другите специалисти в България
Съобщение Ръководството на НУ “Христо Ботев“ – гр. Елин Пелин
НАЦИОНАЛНА АГЕНЦИЯ ЗА ПРИХОДИТЕ
ДОБРОВОЛЕН РЕЗЕРВ НА ВЪОРЪЖЕНИТЕ СИЛИ НА РЕПУБЛИКА БЪЛГАРИЯ
Съвременни софтуерни решения
ПО ПЧЕЛАРСТВО ЗА ТРИГОДИШНИЯ
от проучване на общественото мнение,
Васил Големански Ноември, 2006
Програма за развитие на селските райони
ОПЕРАТИВНА ПРОГРАМА “АДМИНИСТРАТИВЕН КАПАЦИТЕТ”
БАЛИСТИКА НА ТЯЛО ПРИ СВОБОДНО ПАДАНЕ В ЗЕМНАТА АТМОСФЕРА
МЕДИЦИНСКИ УНИВЕРСИТЕТ – ПЛЕВЕН
Стратегия за развитие на клъстера 2015
Моето наследствено призвание
Правна кантора “Джингов, Гугински, Кючуков & Величков”
Безопасност на движението
Introduction to Computer Organization & Systems
EECE.2160 ECE Application Programming
Unit-1 Introduction to Java
More Mutation Testing for Source CS 4501 / 6501 Software Testing
Presentation transcript:

/* example program to demonstrate the passing of an array */ #include 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 );

Copy Right 2012

Back