March 2018
Beginner to intermediate
416 pages
9h 24m
English
In this section, we will illustrate the use of GAWK as a debugger with the help of a sample program which contains certain functions and variables. The program used for the implementation is called calc.awk because it performs certain basic mathematical operations. Let's create the program first, as follows:
$ vi calc.awkfunction find_add(num1, num2){ result = num1 + num2 printf ("Addition of %d + %d : %d\n", num1,num2,result)}function find_sub(num1, num2){ result = num1 - num2 printf ("Subtraction of %d - %d : %d\n", num1,num2,result)}function find_mul(num1, num2){ result = num1 * num2 printf ("Multiplication of %d * %d : %d\n", num1,num2,result)}# Main functionfunction calc(){ find_add(30,10) find_sub(40,10) find_mul(5,6) ...Read now
Unlock full access