📌  相关文章
📜  程序与函数之间的差异

📅  最后修改于: 2021-08-29 11:56:34             🧑  作者: Mango

1.程序:
顾名思义,程序是计算机用来执行特定任务的指令集或指令集,它们是使用特定的编程语言(例如C++, Python,Ruby等)创建的。

2.函数:
顾名思义,函数是计算机编程中的基本概念,它调用一个程序来控制程序流以及执行特定任务,返回一个值,然后在被调用的位置恢复程序。

程序和函数之间的区别:

Program Function
Programs are set of instructions executed by computer. Function is block of organized and reusable code.
Programs has to instruct computer to do particular task. Functions has to perform action or related action.
Programs do not return any result. Function usually return result that can be graphed or entered in table.
It provides framework that set direction of program as well as plan about how objective will be achieved. It provides better modularity for application as well as high degree of reusing code.
It cannot store local and global variables. It can store local and global variables.
Types of programs include system programs, application programs, utility programs, etc. Types of function include modulus function, linear function, quadratic function, exponential function, etc.
Program consists of compiled code that run directly from computers operating system. Functions can be used over and over again once it is defined.
It is larger in size and does not require scripting engine to run. Functions are smaller in size as compared to programs.
Programs are written in both low-level and high-level programming languages and are human readable and writable. Functions can be both low-level or top-level functions.