B (programming Language) - Example

Example

The following example is from the Users' Reference to B by Ken Thompson:

/* The following function will print a non-negative number, n, to the base b, where 2<=b<=10, This routine uses the fact that in the ASCII character set, the digits 0 to 9 have sequential code values. */ printn(n,b) { extrn putchar; auto a; if(a=n/b) /* assignment, not test for equality */ printn(a, b); /* recursive */ putchar(n%b + '0'); }

Read more about this topic:  B (programming Language)

Famous quotes containing the word example:

    Our intellect is not the most subtle, the most powerful, the most appropriate, instrument for revealing the truth. It is life that, little by little, example by example, permits us to see that what is most important to our heart, or to our mind, is learned not by reasoning but through other agencies. Then it is that the intellect, observing their superiority, abdicates its control to them upon reasoned grounds and agrees to become their collaborator and lackey.
    Marcel Proust (1871–1922)