Let us think of a scenario. I need to find answer for 2 to the power 5. My algorithm will be something like this. I place 5 in a memory location 1. Place 2 in a memory location 2. Multiply value in memory location 2 with 2, and everytime I multiply, I will decrement the value in memory location 1 until it reaches 0. We don't need to specify where we need to store the values. Those jobs are taken care by the compiler. It reads the programs, separates them into smaller parts called tokens and checks them against predefined syntax. It then converts the program into codes that machines can understand. More like a conversion from Human readable form to Machine Readable form.
Now, since we will be requiring to find Power of certain numbers many times in a program, we can puts these program into a block called functions. In order to find the power, we just need to call these functions and pass our arguments/inputs (say 2 and 5). Similar to this power function, there will be many other function that are predefined when we install compilers like Turbo C, Borland C etc. These are standards that are set and every compiler for C Programming will follow those standards.
In order to make it more organised, those Predefined functions called INBUILT functions are grouped and put into a package called library files. So all math related functions will be put into one package. All string related functions will be put under one package etc. When we need to make use of these inbuilt functions, we simply include those files into our program.
Now, since we will be requiring to find Power of certain numbers many times in a program, we can puts these program into a block called functions. In order to find the power, we just need to call these functions and pass our arguments/inputs (say 2 and 5). Similar to this power function, there will be many other function that are predefined when we install compilers like Turbo C, Borland C etc. These are standards that are set and every compiler for C Programming will follow those standards.
In order to make it more organised, those Predefined functions called INBUILT functions are grouped and put into a package called library files. So all math related functions will be put into one package. All string related functions will be put under one package etc. When we need to make use of these inbuilt functions, we simply include those files into our program.
0 comments:
Post a Comment