program main some declarations real alpha, beta common /coeff/ alpha, beta statements stop end subroutine sub1 (some arguments) declarations of arguments real alpha, beta common /coeff/ alpha, beta statements return end subroutine sub2 (some arguments) declarations of arguments real alpha, beta common /coeff/ alpha, beta statements return end¿©±â¼ coeffÀ̶ó´Â À̸§ÀÇ common blockÀ» Á¤ÀÇÇÑ´Ù. common blockÀÇ ³»¿ëÀº alpha¿Í beta µÎ º¯¼öÀÌ´Ù. common block¿¡´Â ¿©·¯ °³ÀÇ º¯¼ö¸¦ »ç¿ëÇÒ ¼ö ÀÖ´Ù. ¸ðµÎ°¡ °°Àº ÇüÅÂÀÏ ÇÊ¿ä´Â ¾ø´Ù. common block ¾ÈÀÇ º¯¼ö Áß ¾î´À °ÍÀ» ÇÊ¿ä·Î ÇÏ´Â ¸ðµç subroutine ¿¡¼ Àüü blockÀ» Á¤ÀÇÇÏ¿©¾ß ÇÑ´Ù. declare the whole block.
ÀÌ ¿¹¿¡¼´Â alpah¿Í beta¸¦ parameter(argument)·Î ³Ñ°ÜÁÜÀ¸·Î½á common blockÀ» »ç¿ëÇÏÁö ¾ÊÀ» ¼öµµ ÀÖ´Ù. ÁÁÀº ¹æ¹ýÀº °¡´ÉÇÑ common blockÀ» »ç¿ëÇÏÁö ¾Ê´Â °ÍÀÌ´Ù. ±×·¯³ª ´Ù¸¥ ¹æ¹ýÀÌ ¾ø´Â °æ¿ì°¡ °£È¤ ÀÖ´Ù.
common / name / list-of-variables´ÙÀ½À» ¾Ë¾Æ¾ß ÇÑ´Ù.
subroutine sub3 (some arguments) declarations of arguments real a, b common /coeff/ a, b statements return endÀÌ ¼±¾ðÀº alpha¿Í beta¸¦ »ç¿ëÇÑ ¾ÕÀÇ ¿¹¿Í °°´Ù. È¥µ¿À» ÇÇÇϱâ À§ÇÏ¿© °°Àº common block¿¡¼´Â º¯¼ö À̸§À» °°°Ô ÇÒ °ÍÀ» ±ÇÇÑ´Ù. ´ÙÀ½Àº ¾ÆÁÖ ³ª»Û °æ¿ìÀÇ ¿¹ÀÌ´Ù.
subroutine sub4 (some arguments) declarations of arguments real alpha, beta common /coeff/ beta, alpha statements return end¿©±â¼ alpha´Â main programÀÇ betaÀÌ°í beta´Â main programÀÇ alphaÀÌ´Ù. ÀÌ·¯ÇÑ °ÍÀ» º»´Ù¸é ÀÌ´Â ¾Æ¸¶ ½Ç¼öÀÏ °ÍÀÌ´Ù. ±×·± À߸øÀº ã±â Èûµé´Ù.
program main integer nmax parameter (nmax=20) integer n real A(nmax, nmax) common /matrix/ A, n, nmaxcommon block¿¡´Â ¿ì¼± AÀÇ ¸ðµç ¿ø¼Ò, ±×¸®°í Á¤¼ö n°ú nmaxÀÌ Æ÷ÇԵǾî ÀÖ´Ù. ÀÌÁ¦ matrix A¸¦ ¾î¶² subroutine¿¡¼ »ç¿ëÇÏ°íÀÚ ÇÒ °æ¿ì ¸ðµç subroutines¿¡ °°Àº ¼±¾ðÀ» ³Ö¾î¾ß ÇÑ´Ù. Áï,
subroutine sub1 (...) integer nmax parameter (nmax=20) integer n real A(nmax, nmax) common /matrix/ A, n, nmaxcommon block¿¡ °¡º¯ Â÷¿ø ¹è¿Àº »ç¿ëÇÒ ¼ö ¾ø´Ù. µû¶ó¼ nmaxÀÇ °ªÀº main program¿¡¼¿Í Á¤È®ÇÏ°Ô ÀÏÄ¡ÇÏ¿©¾ß ÇÑ´Ù. matrixÀÇ Å©±â´Â compileÇÒ ¶§ ¾Ë·ÁÁÖ¾î¾ß Çϱ⿡ nmax´Â parameter ¹®Àå¿¡¼ Á¤ÀÇÇÏ¿©¾ß¸¸ ÇÑ´Ù. nmax´Â common block¿¡ Àֱ⿡ subroutine¿¡¼ parameter ¹®À» »ç¿ëÇÏÁö ¾Ê°í ½ÍÀ» Å×Áö¸¸ ÀÌ´Â ±ÔÄ¢¿¡ ¾î±ß³ª´Â ÀÏÀÌ´Ù.
´ÙÀ½Àº º¸Åë common block¿¡ ¹è¿À» ³Ö¾îµµ ¾ò´Â °ÍÀÌ ¾ø´Ù´Â °ÍÀ» º¸¿© ÁÖ´Â ¿¹ÀÌ´Ù. µû¶ó¼ Fortran 77¿¡¼ ¹Ù¶÷Á÷ÇÑ ¹æ¹ýÀº ¹è¿À» argument·Î (leading Â÷¿ø°ú ÇÔ²²)subroutine¿¡ ³Ñ°Ü ÁÖ´Â °ÍÀÌ´Ù.
program main real origo(3), x(3) real d, dist common /silly/ origo read(*,*) origo(1), origo(2), origo(3) 10 continue read(*,*) x(1), x(2), x(3) d = dist(x) write(*,*) 'The distance is ', d if (x(1).ge.0.) goto 10 stop end real function dist (x) real x(3) real x0, y0, z0 common /silly/ x0, y0, z0 dist = sqrt((x(1)-x0)**2 + (x(2)-y0)**2 + (x(3)-z0)**2) return end