SlideShare a Scribd company logo
15

           18

      19

     31

       37

     38

           39

       6/2

1   2555
1


6


7


8


9
10


21


22
Mild Mapping
26


27
standard functions)

                                C                         h
eader   file      C                                 h
                                                 header file
                      #include<header file.h>


                                    C compiler



”              library functions)
type                                             int , float , char ,
double         ,            void
                                                               void
                                          int

 function_name




 type parameter                      parameter           ,         N


parameter              void

 {

    location          variable           declaration




 statement_ ;       statement_ ;   ...    statement_N


 return(value);




                                                              void)
                   return

}
1.                                                    User-defined
Function)



2.                                        Standard       Function)

                                 include directives         header
file


                          2

       1.
       2.


            #include <stdio.h>
            Main ()
            {
                 Function-name2 ();
                 …………………...
                 Function-name1 ();
            }



            #include <stdio.h>
            Main ()
            {
                 Function-name1 ();
Function-name2 ();
             …………………..
        }




1.
                                       #include

2.




                                  ()

                     void
     function_name(void )
void function_name
(type_parameter parameter_name [,..] ) ;

           function_ name

        type_parameter


        parameter_name
               1         ,




       #include <stdio.h>
       Void addition (int , int ) ;
       Void main ()
       {
       Int a,b ;
       ……....
Addition (a,b) ;
  }
  Void addition (int m , int n)
  {
  …............
  }




      Type_variable function_name parameter_name,… ;




Type_variable


function_name

parameter_name
variable_name = function_name();

variable_name




       return (value)
(Local              Variable)




                  (Global              Variable)



(
          )


    /* 7th Sample Program: Local vs Global Variable */
    #include<stdio.h>
    int ans = 0;
    int inc_one(int);            /* function prototype */

    void main()
    {
     int a = 3;
     ans = inc_one(a);
     printf(“Answer is %dn”, ans);
    }
    /* function definition: return x+1 */
    int inc_one(int x)
    {
     int ans;
     ans = x + 1;
return ans;
  }

                                                    ans


                                 (main)
                       ans


                                                a


      inc_one               x     ans
          ans                                       ans



                 inc_one                            ans
                                                inc_one
                           ans
inc_one                                   ans
                                                    ans
#vinclude



2.1

      sinz x

                               :     sin       x    x
               Sin x   ;




      cos x

                           :       cossine      x   x
               cos x   ;




      tan x

                           :       tangent      x   x
               tan x   ;
sqrt x

                        :   2 square    root   x       x
  sqrt x    ;




pow x,y

                    :       x          y x         0
  pow x     ;




ceil x

                    :
   ceil x   ;




floor x

                    :
  floor x       ;




log x
:               log   n    x x   0
  log x     ;




sinz x

                                :              sin       x   x
         Sin x          ;




log10 x

                    :               log   10    x
  log10 x       ;




exp x

                            :                        e       e

    2.718282 x                                  e

         exp x          ;




fabs x
:                     x
             fabs x   ;




2.2

          strcpy

                                  :                 string2

m                      string1
                   Strcpy string1,

             string2



          strcat

                              :

string2                               string1

               strcat string1, string2



          strcmp

                          :

               Strcmp string1,

              string2
          strlen
:

          Strlen string



      strcmpi

                   :

-        string1                  string2        0

-        string1             < string2      <0

-        string1             > string2       >0


          Strcmp string1, strin

        g2
2.3

      tolower

                   :

        Tolower character

      toupper

                   :

        Toupper character
function_name


                -




                    -
-
function_name

type_parameter

parameter_name
tolower
toupper
strcmp

                                 rung




do

{

……………………….

} while (ans !=’n’) ;
-




-
printf

 sin   ()




#include
6

1.



 . type_variable function_name (parameter_name,…);

 . type_variable function_none (parameter_name,…);

 . variable function_name (parameter_name,…);

 . type_variable function_name (parameter_,…);

2.type_variable

 .

 .

 .

 .
3.function_name

 .

 .

 .

 .

4.                                                       1



 .     void

 .   void

 .

 .




5.



 . void function_name (type_parameter parameter_name[…]);

 . void function_name (type_parameter parameter_name);

 . void function_name (type_parameter parameter […]);
.

6.



 .

 .

 .

 .

7.



 .5

 .4

 .3

 .2

8.



 .
.



 .



 .




9.

 .



 .



 .

 .

10.



 .
.




 .




 .




1.   2.   3.   4.   5.   6.   7.   8.   9.   10.
.         7           C


                                http://e-


        learning.snru.ac.th/els/program lesson page _ html


                 21         2555.


                                               http://uhost.rmutp.ac.t

h/kriengkri.l/w3.pdf   18        2555

More Related Content

What's hot

ECMAscript 2015 aka ES6 : à la découverte du nouveau javascript
ECMAscript 2015 aka ES6 : à la découverte du nouveau javascriptECMAscript 2015 aka ES6 : à la découverte du nouveau javascript
ECMAscript 2015 aka ES6 : à la découverte du nouveau javascript
matparisot
 
Simulacion - Algoritmo congruencial cuadratico
Simulacion - Algoritmo congruencial cuadraticoSimulacion - Algoritmo congruencial cuadratico
Simulacion - Algoritmo congruencial cuadratico
José Antonio Sandoval Acosta
 
Docuemnto 6
Docuemnto 6Docuemnto 6
Docuemnto 6
Diana597594
 
Prof.js
Prof.jsProf.js
Prof.js
uupaa
 
Most Common JavaScript Mistakes
Most Common JavaScript MistakesMost Common JavaScript Mistakes
Most Common JavaScript Mistakes
Yoann Gotthilf
 
Programación funcional en Haskell
Programación funcional en HaskellProgramación funcional en Haskell
Programación funcional en HaskellRoberto Bonvallet
 
Cómo crear una calculadora js jv-ng
Cómo crear una calculadora js jv-ngCómo crear una calculadora js jv-ng
Cómo crear una calculadora js jv-ng
gzuz sanchez
 
Monads
MonadsMonads
Monads
calacitizen
 
Understanding Python decorators
Understanding Python decoratorsUnderstanding Python decorators
Understanding Python decorators
JosipKatalinic
 
Java & le pattern matching
Java & le pattern matchingJava & le pattern matching
Java & le pattern matching
Didier Plaindoux
 
Алексей Кутумов, C++ без исключений, часть 3
Алексей Кутумов,  C++ без исключений, часть 3Алексей Кутумов,  C++ без исключений, часть 3
Алексей Кутумов, C++ без исключений, часть 3
Platonov Sergey
 
203lab3
203lab3203lab3
203lab3
BPurev
 
Clang-tidy: путешествие внутрь AST C++
Clang-tidy: путешествие внутрь AST C++Clang-tidy: путешествие внутрь AST C++
Clang-tidy: путешествие внутрь AST C++
corehard_by
 
Sujet bac info 2012 g1, g2 et g3 avec correction
Sujet bac info 2012 g1, g2 et g3 avec correctionSujet bac info 2012 g1, g2 et g3 avec correction
Sujet bac info 2012 g1, g2 et g3 avec correction
borhen boukthir
 
Transaksi onetoone
Transaksi onetooneTransaksi onetoone
Transaksi onetooneRian Rusman
 
JavaScript
JavaScriptJavaScript
JavaScript
LearningTech
 
Создание новых объектов
Создание новых объектовСоздание новых объектов
Создание новых объектов
Constantin Kichinsky
 
Suma de n numeros
Suma de n numerosSuma de n numeros
Suma de n numeros
Beto Calleja
 

What's hot (20)

ECMAscript 2015 aka ES6 : à la découverte du nouveau javascript
ECMAscript 2015 aka ES6 : à la découverte du nouveau javascriptECMAscript 2015 aka ES6 : à la découverte du nouveau javascript
ECMAscript 2015 aka ES6 : à la découverte du nouveau javascript
 
Simulacion - Algoritmo congruencial cuadratico
Simulacion - Algoritmo congruencial cuadraticoSimulacion - Algoritmo congruencial cuadratico
Simulacion - Algoritmo congruencial cuadratico
 
Docuemnto 6
Docuemnto 6Docuemnto 6
Docuemnto 6
 
Prof.js
Prof.jsProf.js
Prof.js
 
Most Common JavaScript Mistakes
Most Common JavaScript MistakesMost Common JavaScript Mistakes
Most Common JavaScript Mistakes
 
Programación funcional en Haskell
Programación funcional en HaskellProgramación funcional en Haskell
Programación funcional en Haskell
 
Cómo crear una calculadora js jv-ng
Cómo crear una calculadora js jv-ngCómo crear una calculadora js jv-ng
Cómo crear una calculadora js jv-ng
 
Monads
MonadsMonads
Monads
 
Understanding Python decorators
Understanding Python decoratorsUnderstanding Python decorators
Understanding Python decorators
 
Java & le pattern matching
Java & le pattern matchingJava & le pattern matching
Java & le pattern matching
 
Алексей Кутумов, C++ без исключений, часть 3
Алексей Кутумов,  C++ без исключений, часть 3Алексей Кутумов,  C++ без исключений, часть 3
Алексей Кутумов, C++ без исключений, часть 3
 
203lab3
203lab3203lab3
203lab3
 
Sine prog
Sine progSine prog
Sine prog
 
Clang-tidy: путешествие внутрь AST C++
Clang-tidy: путешествие внутрь AST C++Clang-tidy: путешествие внутрь AST C++
Clang-tidy: путешествие внутрь AST C++
 
Sujet bac info 2012 g1, g2 et g3 avec correction
Sujet bac info 2012 g1, g2 et g3 avec correctionSujet bac info 2012 g1, g2 et g3 avec correction
Sujet bac info 2012 g1, g2 et g3 avec correction
 
Gjuha paskal
Gjuha paskal Gjuha paskal
Gjuha paskal
 
Transaksi onetoone
Transaksi onetooneTransaksi onetoone
Transaksi onetoone
 
JavaScript
JavaScriptJavaScript
JavaScript
 
Создание новых объектов
Создание новых объектовСоздание новых объектов
Создание новых объектов
 
Suma de n numeros
Suma de n numerosSuma de n numeros
Suma de n numeros
 

Viewers also liked

Storyboard
StoryboardStoryboard
Storyboard
stevetier
 
Magazine Deconstructions
Magazine DeconstructionsMagazine Deconstructions
Magazine Deconstructions
stevetier
 
Magazine Deconstructions
Magazine DeconstructionsMagazine Deconstructions
Magazine Deconstructions
stevetier
 
Arte romano introducción 2010 2011
Arte romano introducción 2010 2011Arte romano introducción 2010 2011
Arte romano introducción 2010 2011
luismillanalonso
 
9 geo población ii 2010 2011
9 geo población ii 2010 20119 geo población ii 2010 2011
9 geo población ii 2010 2011
luismillanalonso
 
8 geo población i 2010 2011
8 geo población i 2010 20118 geo población i 2010 2011
8 geo población i 2010 2011
luismillanalonso
 
Diefdinsis koinonikis pronoias
Diefdinsis koinonikis pronoiasDiefdinsis koinonikis pronoias
Diefdinsis koinonikis pronoiasthanasiskaridas
 
5 geo atmósfera y climas 2010 2011
5 geo atmósfera y climas 2010 20115 geo atmósfera y climas 2010 2011
5 geo atmósfera y climas 2010 2011
luismillanalonso
 
1 geo astronomía 2012 2013 1º eso
1 geo astronomía  2012 2013 1º eso1 geo astronomía  2012 2013 1º eso
1 geo astronomía 2012 2013 1º eso
luismillanalonso
 
Updated cv - Copy
Updated cv - CopyUpdated cv - Copy
Updated cv - Copy
Mo'men saad
 
5 arte gótico introducción 2010 2011
5 arte gótico introducción 2010 20115 arte gótico introducción 2010 2011
5 arte gótico introducción 2010 2011
luismillanalonso
 
Arte renacimiento introducción 2010 2011
Arte renacimiento introducción 2010 2011Arte renacimiento introducción 2010 2011
Arte renacimiento introducción 2010 2011
luismillanalonso
 

Viewers also liked (13)

Storyboard
StoryboardStoryboard
Storyboard
 
Magazine Deconstructions
Magazine DeconstructionsMagazine Deconstructions
Magazine Deconstructions
 
Magazine Deconstructions
Magazine DeconstructionsMagazine Deconstructions
Magazine Deconstructions
 
จาวา1
จาวา1จาวา1
จาวา1
 
Arte romano introducción 2010 2011
Arte romano introducción 2010 2011Arte romano introducción 2010 2011
Arte romano introducción 2010 2011
 
9 geo población ii 2010 2011
9 geo población ii 2010 20119 geo población ii 2010 2011
9 geo población ii 2010 2011
 
8 geo población i 2010 2011
8 geo población i 2010 20118 geo población i 2010 2011
8 geo población i 2010 2011
 
Diefdinsis koinonikis pronoias
Diefdinsis koinonikis pronoiasDiefdinsis koinonikis pronoias
Diefdinsis koinonikis pronoias
 
5 geo atmósfera y climas 2010 2011
5 geo atmósfera y climas 2010 20115 geo atmósfera y climas 2010 2011
5 geo atmósfera y climas 2010 2011
 
1 geo astronomía 2012 2013 1º eso
1 geo astronomía  2012 2013 1º eso1 geo astronomía  2012 2013 1º eso
1 geo astronomía 2012 2013 1º eso
 
Updated cv - Copy
Updated cv - CopyUpdated cv - Copy
Updated cv - Copy
 
5 arte gótico introducción 2010 2011
5 arte gótico introducción 2010 20115 arte gótico introducción 2010 2011
5 arte gótico introducción 2010 2011
 
Arte renacimiento introducción 2010 2011
Arte renacimiento introducción 2010 2011Arte renacimiento introducción 2010 2011
Arte renacimiento introducción 2010 2011
 

More from knangsmiley

งานเดี่ยว1
งานเดี่ยว1งานเดี่ยว1
งานเดี่ยว1knangsmiley
 
งานย่อยที่11
งานย่อยที่11งานย่อยที่11
งานย่อยที่11knangsmiley
 
งานย่อยที่1
งานย่อยที่1งานย่อยที่1
งานย่อยที่1knangsmiley
 
งานย่อยที่1
งานย่อยที่1งานย่อยที่1
งานย่อยที่1knangsmiley
 
จาวา
จาวาจาวา
จาวา
knangsmiley
 
You tube เปิดแอป
You tube เปิดแอปYou tube เปิดแอป
You tube เปิดแอป
knangsmiley
 
It
ItIt

More from knangsmiley (7)

งานเดี่ยว1
งานเดี่ยว1งานเดี่ยว1
งานเดี่ยว1
 
งานย่อยที่11
งานย่อยที่11งานย่อยที่11
งานย่อยที่11
 
งานย่อยที่1
งานย่อยที่1งานย่อยที่1
งานย่อยที่1
 
งานย่อยที่1
งานย่อยที่1งานย่อยที่1
งานย่อยที่1
 
จาวา
จาวาจาวา
จาวา
 
You tube เปิดแอป
You tube เปิดแอปYou tube เปิดแอป
You tube เปิดแอป
 
It
ItIt
It
 

โปรแกรมย่อยและฟังก์ชันมาตรฐาน

  • 1. 15 18 19 31 37 38 39 6/2 1 2555
  • 2.
  • 5. standard functions) C h eader file C h header file #include<header file.h> C compiler ” library functions)
  • 6. type int , float , char , double , void void int function_name type parameter parameter , N parameter void { location variable declaration statement_ ; statement_ ; ... statement_N return(value); void) return }
  • 7. 1. User-defined Function) 2. Standard Function) include directives header file 2 1. 2. #include <stdio.h> Main () { Function-name2 (); …………………... Function-name1 (); } #include <stdio.h> Main () { Function-name1 ();
  • 8. Function-name2 (); ………………….. } 1. #include 2. () void function_name(void )
  • 9. void function_name (type_parameter parameter_name [,..] ) ; function_ name type_parameter parameter_name 1 , #include <stdio.h> Void addition (int , int ) ; Void main () { Int a,b ; ……....
  • 10. Addition (a,b) ; } Void addition (int m , int n) { …............ } Type_variable function_name parameter_name,… ; Type_variable function_name parameter_name
  • 12. (Local Variable) (Global Variable) ( ) /* 7th Sample Program: Local vs Global Variable */ #include<stdio.h> int ans = 0; int inc_one(int); /* function prototype */ void main() { int a = 3; ans = inc_one(a); printf(“Answer is %dn”, ans); } /* function definition: return x+1 */ int inc_one(int x) { int ans; ans = x + 1;
  • 13. return ans; } ans (main) ans a inc_one x ans ans ans inc_one ans inc_one ans inc_one ans ans
  • 14. #vinclude 2.1 sinz x : sin x x Sin x ; cos x : cossine x x cos x ; tan x : tangent x x tan x ;
  • 15. sqrt x : 2 square root x x sqrt x ; pow x,y : x y x 0 pow x ; ceil x : ceil x ; floor x : floor x ; log x
  • 16. : log n x x 0 log x ; sinz x : sin x x Sin x ; log10 x : log 10 x log10 x ; exp x : e e 2.718282 x e exp x ; fabs x
  • 17. : x fabs x ; 2.2 strcpy : string2 m string1 Strcpy string1, string2 strcat : string2 string1 strcat string1, string2 strcmp : Strcmp string1, string2 strlen
  • 18. : Strlen string strcmpi : - string1 string2 0 - string1 < string2 <0 - string1 > string2 >0 Strcmp string1, strin g2 2.3 tolower : Tolower character toupper : Toupper character
  • 20. -
  • 21.
  • 23.
  • 26. strcmp rung do { ………………………. } while (ans !=’n’) ;
  • 27. - -
  • 28. printf sin () #include
  • 29. 6 1. . type_variable function_name (parameter_name,…); . type_variable function_none (parameter_name,…); . variable function_name (parameter_name,…); . type_variable function_name (parameter_,…); 2.type_variable . . . .
  • 30. 3.function_name . . . . 4. 1 . void . void . . 5. . void function_name (type_parameter parameter_name[…]); . void function_name (type_parameter parameter_name); . void function_name (type_parameter parameter […]);
  • 31. . 6. . . . . 7. .5 .4 .3 .2 8. .
  • 32. . . . 9. . . . . 10. .
  • 33. . . . 1. 2. 3. 4. 5. 6. 7. 8. 9. 10.
  • 34.
  • 35. . 7 C http://e- learning.snru.ac.th/els/program lesson page _ html 21 2555. http://uhost.rmutp.ac.t h/kriengkri.l/w3.pdf 18 2555