SlideShare a Scribd company logo
Categories of
   User Defined Functions in ‘C’

                      Prakash Khaire
           Lecturer, B V Patel Inst. of BMC & IT, Gopal
                           Vidyanagar
Prakash Khaire,       B V Patel Inst. Of BMC &




                                                          *
Lecturer              IT, Gopal Vidyanagar
Introduction
Introduction           Functions are categorized based on the arguments are
                       ●
                   passed or whether a value is returned or not
Category 1

Category 2
                                ●Functions with no agruments and no return values.
                                ●Functions with arguments and no return values.

Category 3                      ●Functions with arguments and one return value.
                                ●Functions with no arguments but return a vlues.

Category 4                      ●Functions that return multiple values


Category 5


Recursion




                                                                                              *
     Prakash Khaire,
     Prakash Khaire, Lecturer       B V Patel Inst. Of B V Patel Inst. Of BMC & Vidyanagar
                                                       BMC & IT, Gopal IT, Gopal Vidyanagar
Functions with no arguments and no return values
Introduction
                  ●You do not pass data to the called function.
Category 1        ●function with no return type does not pass

Category 2        back data to the calling function.
                  ●This type of function which does not return
Category 3
                  any value cannot be used in an expression
Category 4
                  it can be used only as independent
Category 5        statement.
Recursion




                                                                                          *
     Prakash Khaire,
     Prakash Khaire, Lecturer   B V Patel Inst. Of B V Patel Inst. Of BMC & Vidyanagar
                                                   BMC & IT, Gopal IT, Gopal Vidyanagar
Functions with no arguments and no return values
Introduction       #include<stdio.h>
                   #include<conio.h>                   void main()
Category 1         void printline()                    {
                   {                                     clrscr();
Category 2              int i;                           printf("Welcome to function in C");
                        printf("n");                    printline();
                        for(i=0;i<30;i++)                printf("Function easy to learn.");
Category 3             {
                                                         printline();
                            printf("-");
Category 4               }                               getch();
                         printf("n");                 }
Category 5         }

Recursion




                                                                                           *
     Prakash Khaire,
     Prakash Khaire, Lecturer    B V Patel Inst. Of B V Patel Inst. Of BMC & Vidyanagar
                                                    BMC & IT, Gopal IT, Gopal Vidyanagar
Functions with no arguments and no return values
Introduction

Category 1

Category 2

Category 3


Category 4

Category 5


Recursion




                                                                                          *
     Prakash Khaire,
     Prakash Khaire, Lecturer   B V Patel Inst. Of B V Patel Inst. Of BMC & Vidyanagar
                                                   BMC & IT, Gopal IT, Gopal Vidyanagar
Functions with arguments and no return value
Introduction
                  ●It accept data from calling function.
Category 1        ●you send data to the called function from

Category 2        calling function but you cannot send result
Category 3
                  data back to the calling function.
Category 4

Category 5


Recursion




                                                                                          *
     Prakash Khaire,
     Prakash Khaire, Lecturer   B V Patel Inst. Of B V Patel Inst. Of BMC & Vidyanagar
                                                   BMC & IT, Gopal IT, Gopal Vidyanagar
Functions with arguments and no return value
Introduction       #include<stdio.h>                           void main()
                   #include<conio.h>                           {
Category 1         void add(int x, int y)                        clrscr();
                   {                                             add(30,15);
Category 2         int result;                                   add(63,49);
                   result = x+y;                                 add(952,321);
                   printf("Sum of %d and %d is %d.nn",x,y,     getch();
Category 3         result);                                    }
                   }
Category 4

Category 5


Recursion




                                                                                          *
     Prakash Khaire,
     Prakash Khaire, Lecturer   B V Patel Inst. Of B V Patel Inst. Of BMC & Vidyanagar
                                                   BMC & IT, Gopal IT, Gopal Vidyanagar
Functions with arguments and no return value
Introduction

Category 1

Category 2

Category 3


Category 4

Category 5


Recursion




                                                                                          *
     Prakash Khaire,
     Prakash Khaire, Lecturer   B V Patel Inst. Of B V Patel Inst. Of BMC & Vidyanagar
                                                   BMC & IT, Gopal IT, Gopal Vidyanagar
Functions with arguments and return value
Introduction      ●It can send arguments (data) from the calling function to the
                  called function
Category 1
                  ●It wait for the result to be returned back from the called function

Category 2
                  back to the calling function
                  ●This type of function is mostly used in programming world

Category 3        because it can do two way communications
                  ●It can accept data as arguments as well as can send back data
Category 4        as return value
                  ●The data returned by the function can be used later in our
Category 5        program for further calculations.
Recursion




                                                                                          *
     Prakash Khaire,
     Prakash Khaire, Lecturer   B V Patel Inst. Of B V Patel Inst. Of BMC & Vidyanagar
                                                   BMC & IT, Gopal IT, Gopal Vidyanagar
Functions with arguments and return value
Introduction       #include<stdio.h>           void main()
                   #include<conio.h>           {
Category 1
                   int add(int x, int y)          int z;
Category 2
                   {                              clrscr();
                   int result;                    z = add(952,321);
Category 3         result = x+y;                  printf("Result %d.nn",add(30,55));
                   return(result);                printf("Result %d.nn",z);
Category 4         }                              getch();
                                               }
Category 5


Recursion




                                                                                          *
     Prakash Khaire,
     Prakash Khaire, Lecturer   B V Patel Inst. Of B V Patel Inst. Of BMC & Vidyanagar
                                                   BMC & IT, Gopal IT, Gopal Vidyanagar
Functions with arguments and return value
Introduction

Category 1

Category 2

Category 3


Category 4

Category 5


Recursion




                                                                                          *
     Prakash Khaire,
     Prakash Khaire, Lecturer   B V Patel Inst. Of B V Patel Inst. Of BMC & Vidyanagar
                                                   BMC & IT, Gopal IT, Gopal Vidyanagar
Functions with no arguments but returns value
Introduction
                  ●A function which does not take any
Category 1        argument but only returns values to the
Category 2        calling function.
                  ●The best example of this type of function is
Category 3
                  “getchar()” library function which is declared
Category 4
                  in the header file “stdio.h”.
Category 5


Recursion




                                                                                          *
     Prakash Khaire,
     Prakash Khaire, Lecturer   B V Patel Inst. Of B V Patel Inst. Of BMC & Vidyanagar
                                                   BMC & IT, Gopal IT, Gopal Vidyanagar
Functions with no arguments but returns value
Introduction       #include<stdio.h>
                                                      void main()
                   #include<conio.h>
Category 1                                            {
                   int send()
                                                          int z;
                   {
Category 2                                                clrscr();
                        int no1;
                                                          z = send();
Category 3              printf("Enter a no : ");
                                                          printf("nYou entered : %d.", z);
                        scanf("%d",&no1);
                                                          getch();
Category 4              return(no1);
                                                      }
                   }
Category 5


Recursion




                                                                                          *
     Prakash Khaire,
     Prakash Khaire, Lecturer   B V Patel Inst. Of B V Patel Inst. Of BMC & Vidyanagar
                                                   BMC & IT, Gopal IT, Gopal Vidyanagar
Functions with no arguments but returns value
Introduction

Category 1

Category 2

Category 3


Category 4

Category 5


Recursion




                                                                                          *
     Prakash Khaire,
     Prakash Khaire, Lecturer   B V Patel Inst. Of B V Patel Inst. Of BMC & Vidyanagar
                                                   BMC & IT, Gopal IT, Gopal Vidyanagar
Functions that return multiple values
Introduction
                  ●To send values to the called function, in the
Category 1        same way we can also use arguments to
Category 2        send back information to the calling function
                  ●The arguments that are used to send back
Category 3
                  data are called Output Parameters.
Category 4

Category 5


Recursion




                                                                                          *
     Prakash Khaire,
     Prakash Khaire, Lecturer   B V Patel Inst. Of B V Patel Inst. Of BMC & Vidyanagar
                                                   BMC & IT, Gopal IT, Gopal Vidyanagar
Functions that return multiple values
Introduction       #include<stdio.h>
                                                      void main()
                   #include<conio.h>
Category 1                                            {
                   void calc(int x, int y, int
                                                      int a=20, b=11, p,q;
                   *add, int *sub)
Category 2                                            clrscr();
                   {
                                                      calc(a,b,&p,&q);
Category 3         *add = x+y;
                                                      printf("Sum = %d, Sub = %d",p,q);
                   *sub = x-y;
                                                      getch();
Category 4         }
                                                      }
Category 5


Recursion




                                                                                          *
     Prakash Khaire,
     Prakash Khaire, Lecturer   B V Patel Inst. Of B V Patel Inst. Of BMC & Vidyanagar
                                                   BMC & IT, Gopal IT, Gopal Vidyanagar
Recursion
Introduction
                 ●A function calling itself again and again to
Category 1
                 compute a value
Category 2       ●Normally function are called by main

Category 3       function or by some another function
                 ●But in recursion the same function is called
Category 4
                 by itself repeatedly
Category 5


Recursion




                                                                                          *
     Prakash Khaire,
     Prakash Khaire, Lecturer   B V Patel Inst. Of B V Patel Inst. Of BMC & Vidyanagar
                                                   BMC & IT, Gopal IT, Gopal Vidyanagar
Closing
Introduction
                    int fact(int k)               1st call -> return(4 * fact(4-1));
                    {                                   return(4 * fact(3));
Category 1                if(k==0)                2nd call -> return(3 * fact(3-1));
                          {                             return(3 * fact(2));
Category 2                       return(1);             3rd call -> return(2 * fact(2-1));
                          }                             return(2 * fact(1));
Category 3                else
                          {
Category 4
                                 return(k * fact(k-1));
                          }
                    }
Category 5


Recursion




                                                                                             *
     Prakash Khaire,
     Prakash Khaire, Lecturer      B V Patel Inst. Of B V Patel Inst. Of BMC & Vidyanagar
                                                      BMC & IT, Gopal IT, Gopal Vidyanagar
Use of Recursive Function
Introduction
                 ●Recursive functions are written with less
Category 1
                 number of statements compared functions
Category 2       ●Recursion is effective where terms are

Category 3       generated successively to compute a value
Category 4

Category 5


Recursion




                                                                                          *
     Prakash Khaire,
     Prakash Khaire, Lecturer   B V Patel Inst. Of B V Patel Inst. Of BMC & Vidyanagar
                                                   BMC & IT, Gopal IT, Gopal Vidyanagar
Ad

More Related Content

What's hot (20)

Operator Overloading and Scope of Variable
Operator Overloading and Scope of VariableOperator Overloading and Scope of Variable
Operator Overloading and Scope of Variable
MOHIT DADU
 
structured programming
structured programmingstructured programming
structured programming
Ahmad54321
 
user defined function
user defined functionuser defined function
user defined function
King Kavin Patel
 
Functions in C - Programming
Functions in C - Programming Functions in C - Programming
Functions in C - Programming
GaurangVishnoi
 
predefined and user defined functions
predefined and user defined functionspredefined and user defined functions
predefined and user defined functions
Swapnil Yadav
 
User defined functions
User defined functionsUser defined functions
User defined functions
Rokonuzzaman Rony
 
Programming Fundamentals Functions in C and types
Programming Fundamentals  Functions in C  and typesProgramming Fundamentals  Functions in C  and types
Programming Fundamentals Functions in C and types
imtiazalijoono
 
Functions in c
Functions in cFunctions in c
Functions in c
reshmy12
 
Functions
FunctionsFunctions
Functions
Mitali Chugh
 
Functions
FunctionsFunctions
Functions
Mitali Chugh
 
Object oriented concepts & programming (2620003)
Object oriented concepts & programming (2620003)Object oriented concepts & programming (2620003)
Object oriented concepts & programming (2620003)
nirajmandaliya
 
Functions in Python
Functions in PythonFunctions in Python
Functions in Python
Shakti Singh Rathore
 
Pointers and call by value, reference, address in C
Pointers and call by value, reference, address in CPointers and call by value, reference, address in C
Pointers and call by value, reference, address in C
Syed Mustafa
 
User defined functions in C programmig
User defined functions in C programmigUser defined functions in C programmig
User defined functions in C programmig
Appili Vamsi Krishna
 
Scope of variables
Scope of variablesScope of variables
Scope of variables
baabtra.com - No. 1 supplier of quality freshers
 
User defined functions in C
User defined functions in CUser defined functions in C
User defined functions in C
Harendra Singh
 
Functions in python slide share
Functions in python slide shareFunctions in python slide share
Functions in python slide share
Devashish Kumar
 
Basics of cpp
Basics of cppBasics of cpp
Basics of cpp
vinay chauhan
 
4. function
4. function4. function
4. function
Shankar Gangaju
 
Functions in Python
Functions in PythonFunctions in Python
Functions in Python
Kamal Acharya
 
Operator Overloading and Scope of Variable
Operator Overloading and Scope of VariableOperator Overloading and Scope of Variable
Operator Overloading and Scope of Variable
MOHIT DADU
 
structured programming
structured programmingstructured programming
structured programming
Ahmad54321
 
Functions in C - Programming
Functions in C - Programming Functions in C - Programming
Functions in C - Programming
GaurangVishnoi
 
predefined and user defined functions
predefined and user defined functionspredefined and user defined functions
predefined and user defined functions
Swapnil Yadav
 
Programming Fundamentals Functions in C and types
Programming Fundamentals  Functions in C  and typesProgramming Fundamentals  Functions in C  and types
Programming Fundamentals Functions in C and types
imtiazalijoono
 
Functions in c
Functions in cFunctions in c
Functions in c
reshmy12
 
Object oriented concepts & programming (2620003)
Object oriented concepts & programming (2620003)Object oriented concepts & programming (2620003)
Object oriented concepts & programming (2620003)
nirajmandaliya
 
Pointers and call by value, reference, address in C
Pointers and call by value, reference, address in CPointers and call by value, reference, address in C
Pointers and call by value, reference, address in C
Syed Mustafa
 
User defined functions in C programmig
User defined functions in C programmigUser defined functions in C programmig
User defined functions in C programmig
Appili Vamsi Krishna
 
User defined functions in C
User defined functions in CUser defined functions in C
User defined functions in C
Harendra Singh
 
Functions in python slide share
Functions in python slide shareFunctions in python slide share
Functions in python slide share
Devashish Kumar
 

Viewers also liked (20)

Lecture15 comparisonoftheloopcontrolstructures.ppt
Lecture15 comparisonoftheloopcontrolstructures.pptLecture15 comparisonoftheloopcontrolstructures.ppt
Lecture15 comparisonoftheloopcontrolstructures.ppt
eShikshak
 
Html phrase tags
Html phrase tagsHtml phrase tags
Html phrase tags
eShikshak
 
Mesics lecture 5 input – output in ‘c’
Mesics lecture 5   input – output in ‘c’Mesics lecture 5   input – output in ‘c’
Mesics lecture 5 input – output in ‘c’
eShikshak
 
Mesics lecture 3 c – constants and variables
Mesics lecture 3   c – constants and variablesMesics lecture 3   c – constants and variables
Mesics lecture 3 c – constants and variables
eShikshak
 
Lecture 7 relational_and_logical_operators
Lecture 7 relational_and_logical_operatorsLecture 7 relational_and_logical_operators
Lecture 7 relational_and_logical_operators
eShikshak
 
Lecture7relationalandlogicaloperators 110823181038-phpapp02
Lecture7relationalandlogicaloperators 110823181038-phpapp02Lecture7relationalandlogicaloperators 110823181038-phpapp02
Lecture7relationalandlogicaloperators 110823181038-phpapp02
eShikshak
 
Mesics lecture files in 'c'
Mesics lecture   files in 'c'Mesics lecture   files in 'c'
Mesics lecture files in 'c'
eShikshak
 
Algorithm
AlgorithmAlgorithm
Algorithm
eShikshak
 
Unit 1.3 types of cloud
Unit 1.3 types of cloudUnit 1.3 types of cloud
Unit 1.3 types of cloud
eShikshak
 
Mesics lecture 8 arrays in 'c'
Mesics lecture 8   arrays in 'c'Mesics lecture 8   arrays in 'c'
Mesics lecture 8 arrays in 'c'
eShikshak
 
Mesics lecture 7 iteration and repetitive executions
Mesics lecture 7   iteration and repetitive executionsMesics lecture 7   iteration and repetitive executions
Mesics lecture 7 iteration and repetitive executions
eShikshak
 
Unit 1.1 introduction to cloud computing
Unit 1.1   introduction to cloud computingUnit 1.1   introduction to cloud computing
Unit 1.1 introduction to cloud computing
eShikshak
 
Algorithm chapter 11
Algorithm chapter 11Algorithm chapter 11
Algorithm chapter 11
chidabdu
 
Lecture19 unionsin c.ppt
Lecture19 unionsin c.pptLecture19 unionsin c.ppt
Lecture19 unionsin c.ppt
eShikshak
 
Unit 1.2 move to cloud computing
Unit 1.2   move to cloud computingUnit 1.2   move to cloud computing
Unit 1.2 move to cloud computing
eShikshak
 
Html text and formatting
Html text and formattingHtml text and formatting
Html text and formatting
eShikshak
 
Linked list
Linked listLinked list
Linked list
eShikshak
 
Mesics lecture 4 c operators and experssions
Mesics lecture  4   c operators and experssionsMesics lecture  4   c operators and experssions
Mesics lecture 4 c operators and experssions
eShikshak
 
Lecture20 user definedfunctions.ppt
Lecture20 user definedfunctions.pptLecture20 user definedfunctions.ppt
Lecture20 user definedfunctions.ppt
eShikshak
 
Lecture13 control statementswitch.ppt
Lecture13 control statementswitch.pptLecture13 control statementswitch.ppt
Lecture13 control statementswitch.ppt
eShikshak
 
Lecture15 comparisonoftheloopcontrolstructures.ppt
Lecture15 comparisonoftheloopcontrolstructures.pptLecture15 comparisonoftheloopcontrolstructures.ppt
Lecture15 comparisonoftheloopcontrolstructures.ppt
eShikshak
 
Html phrase tags
Html phrase tagsHtml phrase tags
Html phrase tags
eShikshak
 
Mesics lecture 5 input – output in ‘c’
Mesics lecture 5   input – output in ‘c’Mesics lecture 5   input – output in ‘c’
Mesics lecture 5 input – output in ‘c’
eShikshak
 
Mesics lecture 3 c – constants and variables
Mesics lecture 3   c – constants and variablesMesics lecture 3   c – constants and variables
Mesics lecture 3 c – constants and variables
eShikshak
 
Lecture 7 relational_and_logical_operators
Lecture 7 relational_and_logical_operatorsLecture 7 relational_and_logical_operators
Lecture 7 relational_and_logical_operators
eShikshak
 
Lecture7relationalandlogicaloperators 110823181038-phpapp02
Lecture7relationalandlogicaloperators 110823181038-phpapp02Lecture7relationalandlogicaloperators 110823181038-phpapp02
Lecture7relationalandlogicaloperators 110823181038-phpapp02
eShikshak
 
Mesics lecture files in 'c'
Mesics lecture   files in 'c'Mesics lecture   files in 'c'
Mesics lecture files in 'c'
eShikshak
 
Unit 1.3 types of cloud
Unit 1.3 types of cloudUnit 1.3 types of cloud
Unit 1.3 types of cloud
eShikshak
 
Mesics lecture 8 arrays in 'c'
Mesics lecture 8   arrays in 'c'Mesics lecture 8   arrays in 'c'
Mesics lecture 8 arrays in 'c'
eShikshak
 
Mesics lecture 7 iteration and repetitive executions
Mesics lecture 7   iteration and repetitive executionsMesics lecture 7   iteration and repetitive executions
Mesics lecture 7 iteration and repetitive executions
eShikshak
 
Unit 1.1 introduction to cloud computing
Unit 1.1   introduction to cloud computingUnit 1.1   introduction to cloud computing
Unit 1.1 introduction to cloud computing
eShikshak
 
Algorithm chapter 11
Algorithm chapter 11Algorithm chapter 11
Algorithm chapter 11
chidabdu
 
Lecture19 unionsin c.ppt
Lecture19 unionsin c.pptLecture19 unionsin c.ppt
Lecture19 unionsin c.ppt
eShikshak
 
Unit 1.2 move to cloud computing
Unit 1.2   move to cloud computingUnit 1.2   move to cloud computing
Unit 1.2 move to cloud computing
eShikshak
 
Html text and formatting
Html text and formattingHtml text and formatting
Html text and formatting
eShikshak
 
Mesics lecture 4 c operators and experssions
Mesics lecture  4   c operators and experssionsMesics lecture  4   c operators and experssions
Mesics lecture 4 c operators and experssions
eShikshak
 
Lecture20 user definedfunctions.ppt
Lecture20 user definedfunctions.pptLecture20 user definedfunctions.ppt
Lecture20 user definedfunctions.ppt
eShikshak
 
Lecture13 control statementswitch.ppt
Lecture13 control statementswitch.pptLecture13 control statementswitch.ppt
Lecture13 control statementswitch.ppt
eShikshak
 
Ad

Similar to Lecture21 categoriesof userdefinedfunctions.ppt (6)

Example for Virtual and Pure Virtual function.pdf
Example for Virtual and Pure Virtual function.pdfExample for Virtual and Pure Virtual function.pdf
Example for Virtual and Pure Virtual function.pdf
rajaratna4
 
Intro-OOP-PPT- an introduction to the su
Intro-OOP-PPT- an introduction to the suIntro-OOP-PPT- an introduction to the su
Intro-OOP-PPT- an introduction to the su
ImranAliQureshi3
 
OOP PPT 1.pptx
OOP PPT 1.pptxOOP PPT 1.pptx
OOP PPT 1.pptx
lathass5
 
Unit 1
Unit 1Unit 1
Unit 1
S.S.B.T’s. College of Engineering & Technology
 
Unit_2.0_Functions (1).pdfUnit_2.0_Functions (1).pdf
Unit_2.0_Functions (1).pdfUnit_2.0_Functions (1).pdfUnit_2.0_Functions (1).pdfUnit_2.0_Functions (1).pdf
Unit_2.0_Functions (1).pdfUnit_2.0_Functions (1).pdf
RutviBaraiya
 
Unit 2
Unit 2Unit 2
Unit 2
S.S.B.T’s. College of Engineering & Technology
 
Ad

More from eShikshak (15)

Modelling and evaluation
Modelling and evaluationModelling and evaluation
Modelling and evaluation
eShikshak
 
Operators in python
Operators in pythonOperators in python
Operators in python
eShikshak
 
Datatypes in python
Datatypes in pythonDatatypes in python
Datatypes in python
eShikshak
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
eShikshak
 
Introduction to e commerce
Introduction to e commerceIntroduction to e commerce
Introduction to e commerce
eShikshak
 
Chapeter 2 introduction to cloud computing
Chapeter 2   introduction to cloud computingChapeter 2   introduction to cloud computing
Chapeter 2 introduction to cloud computing
eShikshak
 
Unit 1.4 working of cloud computing
Unit 1.4 working of cloud computingUnit 1.4 working of cloud computing
Unit 1.4 working of cloud computing
eShikshak
 
Mesics lecture 6 control statement = if -else if__else
Mesics lecture 6   control statement = if -else if__elseMesics lecture 6   control statement = if -else if__else
Mesics lecture 6 control statement = if -else if__else
eShikshak
 
Mesics lecture 5 input – output in ‘c’
Mesics lecture 5   input – output in ‘c’Mesics lecture 5   input – output in ‘c’
Mesics lecture 5 input – output in ‘c’
eShikshak
 
Lecture18 structurein c.ppt
Lecture18 structurein c.pptLecture18 structurein c.ppt
Lecture18 structurein c.ppt
eShikshak
 
Lecture17 arrays.ppt
Lecture17 arrays.pptLecture17 arrays.ppt
Lecture17 arrays.ppt
eShikshak
 
Lecturer23 pointersin c.ppt
Lecturer23 pointersin c.pptLecturer23 pointersin c.ppt
Lecturer23 pointersin c.ppt
eShikshak
 
Program development cyle
Program development cyleProgram development cyle
Program development cyle
eShikshak
 
Language processors
Language processorsLanguage processors
Language processors
eShikshak
 
Computer programming programming_langugages
Computer programming programming_langugagesComputer programming programming_langugages
Computer programming programming_langugages
eShikshak
 
Modelling and evaluation
Modelling and evaluationModelling and evaluation
Modelling and evaluation
eShikshak
 
Operators in python
Operators in pythonOperators in python
Operators in python
eShikshak
 
Datatypes in python
Datatypes in pythonDatatypes in python
Datatypes in python
eShikshak
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
eShikshak
 
Introduction to e commerce
Introduction to e commerceIntroduction to e commerce
Introduction to e commerce
eShikshak
 
Chapeter 2 introduction to cloud computing
Chapeter 2   introduction to cloud computingChapeter 2   introduction to cloud computing
Chapeter 2 introduction to cloud computing
eShikshak
 
Unit 1.4 working of cloud computing
Unit 1.4 working of cloud computingUnit 1.4 working of cloud computing
Unit 1.4 working of cloud computing
eShikshak
 
Mesics lecture 6 control statement = if -else if__else
Mesics lecture 6   control statement = if -else if__elseMesics lecture 6   control statement = if -else if__else
Mesics lecture 6 control statement = if -else if__else
eShikshak
 
Mesics lecture 5 input – output in ‘c’
Mesics lecture 5   input – output in ‘c’Mesics lecture 5   input – output in ‘c’
Mesics lecture 5 input – output in ‘c’
eShikshak
 
Lecture18 structurein c.ppt
Lecture18 structurein c.pptLecture18 structurein c.ppt
Lecture18 structurein c.ppt
eShikshak
 
Lecture17 arrays.ppt
Lecture17 arrays.pptLecture17 arrays.ppt
Lecture17 arrays.ppt
eShikshak
 
Lecturer23 pointersin c.ppt
Lecturer23 pointersin c.pptLecturer23 pointersin c.ppt
Lecturer23 pointersin c.ppt
eShikshak
 
Program development cyle
Program development cyleProgram development cyle
Program development cyle
eShikshak
 
Language processors
Language processorsLanguage processors
Language processors
eShikshak
 
Computer programming programming_langugages
Computer programming programming_langugagesComputer programming programming_langugages
Computer programming programming_langugages
eShikshak
 

Recently uploaded (20)

Cybersecurity Threat Vectors and Mitigation
Cybersecurity Threat Vectors and MitigationCybersecurity Threat Vectors and Mitigation
Cybersecurity Threat Vectors and Mitigation
VICTOR MAESTRE RAMIREZ
 
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptxReimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
John Moore
 
AI-proof your career by Olivier Vroom and David WIlliamson
AI-proof your career by Olivier Vroom and David WIlliamsonAI-proof your career by Olivier Vroom and David WIlliamson
AI-proof your career by Olivier Vroom and David WIlliamson
UXPA Boston
 
Top 5 Benefits of Using Molybdenum Rods in Industrial Applications.pptx
Top 5 Benefits of Using Molybdenum Rods in Industrial Applications.pptxTop 5 Benefits of Using Molybdenum Rods in Industrial Applications.pptx
Top 5 Benefits of Using Molybdenum Rods in Industrial Applications.pptx
mkubeusa
 
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à GenèveUiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPathCommunity
 
Bepents tech services - a premier cybersecurity consulting firm
Bepents tech services - a premier cybersecurity consulting firmBepents tech services - a premier cybersecurity consulting firm
Bepents tech services - a premier cybersecurity consulting firm
Benard76
 
Slack like a pro: strategies for 10x engineering teams
Slack like a pro: strategies for 10x engineering teamsSlack like a pro: strategies for 10x engineering teams
Slack like a pro: strategies for 10x engineering teams
Nacho Cougil
 
Artificial_Intelligence_in_Everyday_Life.pptx
Artificial_Intelligence_in_Everyday_Life.pptxArtificial_Intelligence_in_Everyday_Life.pptx
Artificial_Intelligence_in_Everyday_Life.pptx
03ANMOLCHAURASIYA
 
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Christian Folini
 
Dark Dynamism: drones, dark factories and deurbanization
Dark Dynamism: drones, dark factories and deurbanizationDark Dynamism: drones, dark factories and deurbanization
Dark Dynamism: drones, dark factories and deurbanization
Jakub Šimek
 
Q1 2025 Dropbox Earnings and Investor Presentation
Q1 2025 Dropbox Earnings and Investor PresentationQ1 2025 Dropbox Earnings and Investor Presentation
Q1 2025 Dropbox Earnings and Investor Presentation
Dropbox
 
Design pattern talk by Kaya Weers - 2025 (v2)
Design pattern talk by Kaya Weers - 2025 (v2)Design pattern talk by Kaya Weers - 2025 (v2)
Design pattern talk by Kaya Weers - 2025 (v2)
Kaya Weers
 
May Patch Tuesday
May Patch TuesdayMay Patch Tuesday
May Patch Tuesday
Ivanti
 
Viam product demo_ Deploying and scaling AI with hardware.pdf
Viam product demo_ Deploying and scaling AI with hardware.pdfViam product demo_ Deploying and scaling AI with hardware.pdf
Viam product demo_ Deploying and scaling AI with hardware.pdf
camilalamoratta
 
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
Ivano Malavolta
 
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Markus Eisele
 
IT484 Cyber Forensics_Information Technology
IT484 Cyber Forensics_Information TechnologyIT484 Cyber Forensics_Information Technology
IT484 Cyber Forensics_Information Technology
SHEHABALYAMANI
 
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
James Anderson
 
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
Lorenzo Miniero
 
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
SOFTTECHHUB
 
Cybersecurity Threat Vectors and Mitigation
Cybersecurity Threat Vectors and MitigationCybersecurity Threat Vectors and Mitigation
Cybersecurity Threat Vectors and Mitigation
VICTOR MAESTRE RAMIREZ
 
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptxReimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
John Moore
 
AI-proof your career by Olivier Vroom and David WIlliamson
AI-proof your career by Olivier Vroom and David WIlliamsonAI-proof your career by Olivier Vroom and David WIlliamson
AI-proof your career by Olivier Vroom and David WIlliamson
UXPA Boston
 
Top 5 Benefits of Using Molybdenum Rods in Industrial Applications.pptx
Top 5 Benefits of Using Molybdenum Rods in Industrial Applications.pptxTop 5 Benefits of Using Molybdenum Rods in Industrial Applications.pptx
Top 5 Benefits of Using Molybdenum Rods in Industrial Applications.pptx
mkubeusa
 
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à GenèveUiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPathCommunity
 
Bepents tech services - a premier cybersecurity consulting firm
Bepents tech services - a premier cybersecurity consulting firmBepents tech services - a premier cybersecurity consulting firm
Bepents tech services - a premier cybersecurity consulting firm
Benard76
 
Slack like a pro: strategies for 10x engineering teams
Slack like a pro: strategies for 10x engineering teamsSlack like a pro: strategies for 10x engineering teams
Slack like a pro: strategies for 10x engineering teams
Nacho Cougil
 
Artificial_Intelligence_in_Everyday_Life.pptx
Artificial_Intelligence_in_Everyday_Life.pptxArtificial_Intelligence_in_Everyday_Life.pptx
Artificial_Intelligence_in_Everyday_Life.pptx
03ANMOLCHAURASIYA
 
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Christian Folini
 
Dark Dynamism: drones, dark factories and deurbanization
Dark Dynamism: drones, dark factories and deurbanizationDark Dynamism: drones, dark factories and deurbanization
Dark Dynamism: drones, dark factories and deurbanization
Jakub Šimek
 
Q1 2025 Dropbox Earnings and Investor Presentation
Q1 2025 Dropbox Earnings and Investor PresentationQ1 2025 Dropbox Earnings and Investor Presentation
Q1 2025 Dropbox Earnings and Investor Presentation
Dropbox
 
Design pattern talk by Kaya Weers - 2025 (v2)
Design pattern talk by Kaya Weers - 2025 (v2)Design pattern talk by Kaya Weers - 2025 (v2)
Design pattern talk by Kaya Weers - 2025 (v2)
Kaya Weers
 
May Patch Tuesday
May Patch TuesdayMay Patch Tuesday
May Patch Tuesday
Ivanti
 
Viam product demo_ Deploying and scaling AI with hardware.pdf
Viam product demo_ Deploying and scaling AI with hardware.pdfViam product demo_ Deploying and scaling AI with hardware.pdf
Viam product demo_ Deploying and scaling AI with hardware.pdf
camilalamoratta
 
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
Ivano Malavolta
 
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Markus Eisele
 
IT484 Cyber Forensics_Information Technology
IT484 Cyber Forensics_Information TechnologyIT484 Cyber Forensics_Information Technology
IT484 Cyber Forensics_Information Technology
SHEHABALYAMANI
 
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
James Anderson
 
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
Lorenzo Miniero
 
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
SOFTTECHHUB
 

Lecture21 categoriesof userdefinedfunctions.ppt

  • 1. Categories of User Defined Functions in ‘C’ Prakash Khaire Lecturer, B V Patel Inst. of BMC & IT, Gopal Vidyanagar Prakash Khaire, B V Patel Inst. Of BMC & * Lecturer IT, Gopal Vidyanagar
  • 2. Introduction Introduction Functions are categorized based on the arguments are ● passed or whether a value is returned or not Category 1 Category 2 ●Functions with no agruments and no return values. ●Functions with arguments and no return values. Category 3 ●Functions with arguments and one return value. ●Functions with no arguments but return a vlues. Category 4 ●Functions that return multiple values Category 5 Recursion * Prakash Khaire, Prakash Khaire, Lecturer B V Patel Inst. Of B V Patel Inst. Of BMC & Vidyanagar BMC & IT, Gopal IT, Gopal Vidyanagar
  • 3. Functions with no arguments and no return values Introduction ●You do not pass data to the called function. Category 1 ●function with no return type does not pass Category 2 back data to the calling function. ●This type of function which does not return Category 3 any value cannot be used in an expression Category 4 it can be used only as independent Category 5 statement. Recursion * Prakash Khaire, Prakash Khaire, Lecturer B V Patel Inst. Of B V Patel Inst. Of BMC & Vidyanagar BMC & IT, Gopal IT, Gopal Vidyanagar
  • 4. Functions with no arguments and no return values Introduction #include<stdio.h> #include<conio.h> void main() Category 1 void printline() { { clrscr(); Category 2 int i; printf("Welcome to function in C"); printf("n"); printline(); for(i=0;i<30;i++) printf("Function easy to learn."); Category 3 { printline(); printf("-"); Category 4 } getch(); printf("n"); } Category 5 } Recursion * Prakash Khaire, Prakash Khaire, Lecturer B V Patel Inst. Of B V Patel Inst. Of BMC & Vidyanagar BMC & IT, Gopal IT, Gopal Vidyanagar
  • 5. Functions with no arguments and no return values Introduction Category 1 Category 2 Category 3 Category 4 Category 5 Recursion * Prakash Khaire, Prakash Khaire, Lecturer B V Patel Inst. Of B V Patel Inst. Of BMC & Vidyanagar BMC & IT, Gopal IT, Gopal Vidyanagar
  • 6. Functions with arguments and no return value Introduction ●It accept data from calling function. Category 1 ●you send data to the called function from Category 2 calling function but you cannot send result Category 3 data back to the calling function. Category 4 Category 5 Recursion * Prakash Khaire, Prakash Khaire, Lecturer B V Patel Inst. Of B V Patel Inst. Of BMC & Vidyanagar BMC & IT, Gopal IT, Gopal Vidyanagar
  • 7. Functions with arguments and no return value Introduction #include<stdio.h> void main() #include<conio.h> { Category 1 void add(int x, int y) clrscr(); { add(30,15); Category 2 int result; add(63,49); result = x+y; add(952,321); printf("Sum of %d and %d is %d.nn",x,y, getch(); Category 3 result); } } Category 4 Category 5 Recursion * Prakash Khaire, Prakash Khaire, Lecturer B V Patel Inst. Of B V Patel Inst. Of BMC & Vidyanagar BMC & IT, Gopal IT, Gopal Vidyanagar
  • 8. Functions with arguments and no return value Introduction Category 1 Category 2 Category 3 Category 4 Category 5 Recursion * Prakash Khaire, Prakash Khaire, Lecturer B V Patel Inst. Of B V Patel Inst. Of BMC & Vidyanagar BMC & IT, Gopal IT, Gopal Vidyanagar
  • 9. Functions with arguments and return value Introduction ●It can send arguments (data) from the calling function to the called function Category 1 ●It wait for the result to be returned back from the called function Category 2 back to the calling function ●This type of function is mostly used in programming world Category 3 because it can do two way communications ●It can accept data as arguments as well as can send back data Category 4 as return value ●The data returned by the function can be used later in our Category 5 program for further calculations. Recursion * Prakash Khaire, Prakash Khaire, Lecturer B V Patel Inst. Of B V Patel Inst. Of BMC & Vidyanagar BMC & IT, Gopal IT, Gopal Vidyanagar
  • 10. Functions with arguments and return value Introduction #include<stdio.h> void main() #include<conio.h> { Category 1 int add(int x, int y) int z; Category 2 { clrscr(); int result; z = add(952,321); Category 3 result = x+y; printf("Result %d.nn",add(30,55)); return(result); printf("Result %d.nn",z); Category 4 } getch(); } Category 5 Recursion * Prakash Khaire, Prakash Khaire, Lecturer B V Patel Inst. Of B V Patel Inst. Of BMC & Vidyanagar BMC & IT, Gopal IT, Gopal Vidyanagar
  • 11. Functions with arguments and return value Introduction Category 1 Category 2 Category 3 Category 4 Category 5 Recursion * Prakash Khaire, Prakash Khaire, Lecturer B V Patel Inst. Of B V Patel Inst. Of BMC & Vidyanagar BMC & IT, Gopal IT, Gopal Vidyanagar
  • 12. Functions with no arguments but returns value Introduction ●A function which does not take any Category 1 argument but only returns values to the Category 2 calling function. ●The best example of this type of function is Category 3 “getchar()” library function which is declared Category 4 in the header file “stdio.h”. Category 5 Recursion * Prakash Khaire, Prakash Khaire, Lecturer B V Patel Inst. Of B V Patel Inst. Of BMC & Vidyanagar BMC & IT, Gopal IT, Gopal Vidyanagar
  • 13. Functions with no arguments but returns value Introduction #include<stdio.h> void main() #include<conio.h> Category 1 { int send() int z; { Category 2 clrscr(); int no1; z = send(); Category 3 printf("Enter a no : "); printf("nYou entered : %d.", z); scanf("%d",&no1); getch(); Category 4 return(no1); } } Category 5 Recursion * Prakash Khaire, Prakash Khaire, Lecturer B V Patel Inst. Of B V Patel Inst. Of BMC & Vidyanagar BMC & IT, Gopal IT, Gopal Vidyanagar
  • 14. Functions with no arguments but returns value Introduction Category 1 Category 2 Category 3 Category 4 Category 5 Recursion * Prakash Khaire, Prakash Khaire, Lecturer B V Patel Inst. Of B V Patel Inst. Of BMC & Vidyanagar BMC & IT, Gopal IT, Gopal Vidyanagar
  • 15. Functions that return multiple values Introduction ●To send values to the called function, in the Category 1 same way we can also use arguments to Category 2 send back information to the calling function ●The arguments that are used to send back Category 3 data are called Output Parameters. Category 4 Category 5 Recursion * Prakash Khaire, Prakash Khaire, Lecturer B V Patel Inst. Of B V Patel Inst. Of BMC & Vidyanagar BMC & IT, Gopal IT, Gopal Vidyanagar
  • 16. Functions that return multiple values Introduction #include<stdio.h> void main() #include<conio.h> Category 1 { void calc(int x, int y, int int a=20, b=11, p,q; *add, int *sub) Category 2 clrscr(); { calc(a,b,&p,&q); Category 3 *add = x+y; printf("Sum = %d, Sub = %d",p,q); *sub = x-y; getch(); Category 4 } } Category 5 Recursion * Prakash Khaire, Prakash Khaire, Lecturer B V Patel Inst. Of B V Patel Inst. Of BMC & Vidyanagar BMC & IT, Gopal IT, Gopal Vidyanagar
  • 17. Recursion Introduction ●A function calling itself again and again to Category 1 compute a value Category 2 ●Normally function are called by main Category 3 function or by some another function ●But in recursion the same function is called Category 4 by itself repeatedly Category 5 Recursion * Prakash Khaire, Prakash Khaire, Lecturer B V Patel Inst. Of B V Patel Inst. Of BMC & Vidyanagar BMC & IT, Gopal IT, Gopal Vidyanagar
  • 18. Closing Introduction int fact(int k) 1st call -> return(4 * fact(4-1)); { return(4 * fact(3)); Category 1 if(k==0) 2nd call -> return(3 * fact(3-1)); { return(3 * fact(2)); Category 2 return(1); 3rd call -> return(2 * fact(2-1)); } return(2 * fact(1)); Category 3 else { Category 4 return(k * fact(k-1)); } } Category 5 Recursion * Prakash Khaire, Prakash Khaire, Lecturer B V Patel Inst. Of B V Patel Inst. Of BMC & Vidyanagar BMC & IT, Gopal IT, Gopal Vidyanagar
  • 19. Use of Recursive Function Introduction ●Recursive functions are written with less Category 1 number of statements compared functions Category 2 ●Recursion is effective where terms are Category 3 generated successively to compute a value Category 4 Category 5 Recursion * Prakash Khaire, Prakash Khaire, Lecturer B V Patel Inst. Of B V Patel Inst. Of BMC & Vidyanagar BMC & IT, Gopal IT, Gopal Vidyanagar
  翻译: