C Tutorial Euclid's Algorithm in C
The C Language
C History
BCPL
Euclid’s Algorithm in C

Euclid on the PDP-11
Pieces of C
C Types
Declarators
Struct bit-fields
Code generated by bit fields
C Unions
Layout of Records and Unions
C Storage Classes
malloc() and free()
Dynamic Storage Allocation
Simple Dynamic Storage Allocation
malloc() and free() variants
Fragmentation
Fragmentation and Handles
Automatic Garbage Collection
Arrays
Lazy Logical Operators
The Switch Statement
setjmp/longjmp: Sloppy exceptions
Nondeterminism in C

 

 

HOME
 


Line 1: int gcd(int m, int n ) 

        {

 Line2:              int r; 

            while ((r = m % n) != 0)

          m = n; 

          n = r; 

       } 

           return n; 

          }

 

Line 1:“New syle” function
declaration lists number and type of arguments. Originally only listed return type. Generated code did not care how many arguments were actually passed,
and everything was a word. Arguments are call-by-value


Line2:Automatic variable Allocated on stack when function entered, released on return Parameters & automatic variables accessed via frame pointer
,Other temporaries also stacked


 

Contact for more learning: webmaster@freehost7com