SlideServe
Menu
Préférences
© SlideServe · v2026

Mastering Functions in Windows Programming with C: A Comprehensive Guide

kaden avatar
10 diapositives · 229 Views · Aug 28, 2014

This chapter delves into the significance of functions in C programming within a Windows environment. It discusses built-in system functions, including numerical operations and pseudo-random number generation, alongside user-defined functions emphasizing call-by-value and call-by-address parameter passing techniques. Special attention is given to recursive functions with a demonstration of the Fibonacci function. Additionally, the chapter introduces console application development using Borland C++Builder, providing practical insights for efficient coding practices in Windows programming.

Mastering Functions in Windows Programming with C: A Comprehensive Guide - slide 1
01 / 10Mastering Functions in Windows Programming with C: A Comprehensive Guide
1 / 17

Télécharger la présentation

Mastering Functions in Windows Programming with C: A Comprehensive Guide
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. Chapter 11 Functions Windows Programming, C.-S. Shieh, KUAS EC, 2005

  2. 11.1 Functions • Why functions? • sin(x),sqrt(x), … • Structural programming • Maintenance Windows Programming, C.-S. Shieh, KUAS EC, 2005

  3. 11.2 System Functions • Pseudo Number Generator • #include <stdlib.h> • rand(), srand(),randomize() • Numerical • #include <math.h> • fabs(), pow(), sqrt(), sin(), cos(), tan(), asin(), acos(), atan(), exp(), log(), log10(), ceil(), floor() Windows Programming, C.-S. Shieh, KUAS EC, 2005

  4. 11.2 System Functions (cont) • Clock • #include <time.h> • clock(), time() Windows Programming, C.-S. Shieh, KUAS EC, 2005

  5. 11.3 User Defined Functions int sum(int i, int j) { int k; k=i+j; return(k); } void main(void) { printf(“%d”,sum(5,4)); } Windows Programming, C.-S. Shieh, KUAS EC, 2005

  6. 11.4 Parameter Passing • Call-by-Value int sum(int i, int j) { int k; k=i+j; return(k); } void main(void) { int x=5; int y=4; printf(“%d”,sum(x,y)); } Windows Programming, C.-S. Shieh, KUAS EC, 2005

  7. 11.4 Parameter Passing (cont) • Call-by-Address void inc(int i) void inc(int* ip) { { i++; (*ip)++; } } void main(void) void main(void) { { int i=1; int i=1; inc(i); inc(&i); printf(“%d”,i); printf(“%d”,i); } } Windows Programming, C.-S. Shieh, KUAS EC, 2005

  8. 11.5 Passing Array as Parameter void sort(int x[10]) { … } void main(void) { int x[10]={5,7,3,45,8,5,4,24,67,23}; sort(x); } Windows Programming, C.-S. Shieh, KUAS EC, 2005

  9. 11.6 Recursive Functions • Recursive Function • Recursive Relation • Terminate Condition • Fabonacci function long fabo(long i) { if(i==0) return 0; if(i==1) return 1; if(i>=2) return fabo(i-1)+fabo(i-2); } Windows Programming, C.-S. Shieh, KUAS EC, 2005

  10. Console Applications • Develop console applications using Borland C++Builder • FileNew…Console Wizard Windows Programming, C.-S. Shieh, KUAS EC, 2005