You are currently viewing Basics of function in python vs c
Function in c vs python

Basics of function in python vs c

Spread the love

As like C python also allow to device a large program into the basic block is known as function.

In function curly bracket contain the set of programming statements {}

A function can be called more than one time to provide reusability to the user.

Two types of function in python

  1. User defined function
  2. Built in function

We know that user defined function are those function declared by user to perform some specific task.

Python built in function are those function that are predefined in python

Advantage of function in python

  1. With the help of function, we can avoid same logic or code again and again
  2. We can call python function multiple time in aprogram and anywhere in python
Syntax of function in python
def my_function(parameters):
    function block
return expression.

Example:

Function in c vs python
Function in c vs python
def sach():
    print("PS")
sach()

Here we create sach function and pass the parameters then finally call sach function we got output is PS.

Two types of function in C

  1. Library function
  2. User_defined function

Library function are the function which are declared in the c header file sach as a scanf(), printf(), puts() etc.

user defined function which are make by C programmers

Syntax of C function

Sr. No.C FunctionSyntax
1function declarationreturn_type
function_name
(argument list)
2Function callfunction_name
(argument list)
3Function definationreturn_type
function name
(argument list)
{function body;}
Syntax Table in C

Summary:

In this article we saw difference between function for C and python so about this article you have any query then free to ask me.

sachin Pagar

I am Mr. Sachin pagar Embedded software engineer, the founder of Sach Educational Support(Pythonslearning), a Passionate Educational Blogger and Author, who love to share the informative content on educational resources.

Leave a Reply