## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

No credit card required

# Using GAWK as a debugger

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) ...`

## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

No credit card required