Function

Presentation on function in 'c-language'   by- Sanju & Amit
function Defination:- function is a self-contained block of program that performs a coherent task of some kinds. Function is also called  as modular programming.
  Types of function ,[object Object]
User define function
library function ,[object Object],[object Object]
Scanf( )
  User define function ,[object Object],This function as to be developed by the user at the time of writing a program. ‘ main’  is specially used function in C. Every program must have main function to indicate, where the program begins its execution.   
Things to make function ,[object Object],[object Object]
Function definition
Function call A  function call  is an expression containing a simple type name and a parenthesized argument list. The argument list can contain any number of expressions separated by commas. It can also be empty. For example: res=  sum ( a , b); prime(&no);
Function definition In C user- written functions should normally be declared prior to its use to allow compiler to perform type checking on arguments used in its call statement.   Syntex- Return_data_type  function_name (data_type Var_name, …..);
[object Object],int  sum  (int a, int b) Note- “ sum ” is the function name  ,[object Object],int   sum (int a, int b) Note- “ int ” is the return data type
  ,[object Object],int  sum ( int  a , int  b ) Note- “ int  a  , int  b ” are the parameters.
Function declaration and prototypes All identifiers in C need to be declared before they are used. For functions the declaration needs to be before the first call of the function. A full declaration includes the return type and the number and type of the arguments. This is also called the function prototype. The prototype gives a lot of information about the function. #include <stdio.h> int sum (int a, int b);  //prototype ,[object Object]
it tells it how many parameters there are.
Argument  –  passing of values b/w the main program and the function takes place through arguments. Formal  and actual argument-  The actual arguments are the arguments with which the function can be called.  Simply function call contains actual arguments. // Call func with actual arguments i and j. func( i, j ); -The formal arguments are the arguments with which the function can be defined. function defination contains formal arguments void Func( int i );   // Function prototype  … Func( 7 );  // Execute function call
CALL BY VALUE AND CALL BY REFERENCE   Call by value- Whenever  we called a function and passed something to it we have always passed the ‘values’ of variables to the called function. Such function calls are called ‘calls by value. in this context we are working on copies of actual argument.
swap ( a, b ) ;  main( )  {   int a = 10, b = 20 ;   printf ( &quot; a = %d b = %d&quot;, a, b ) ; ,[object Object]
swap ( int x, int y )
{
int t ;
t = x ;
1 von 22

Recomendados

Function in c von
Function in cFunction in c
Function in cRaj Tandukar
6.8K views22 Folien
C functions von
C functionsC functions
C functionsUniversity of Potsdam
9.9K views32 Folien
Function in c von
Function in cFunction in c
Function in csavitamhaske
1.3K views18 Folien
Functions in c language von
Functions in c language Functions in c language
Functions in c language tanmaymodi4
2.6K views30 Folien
Functions in c von
Functions in cFunctions in c
Functions in csunila tharagaturi
1.5K views42 Folien
Function in c program von
Function in c programFunction in c program
Function in c programumesh patil
1.3K views23 Folien

Más contenido relacionado

Was ist angesagt?

Function overloading(c++) von
Function overloading(c++)Function overloading(c++)
Function overloading(c++)Ritika Sharma
14.6K views21 Folien
Function in C von
Function in CFunction in C
Function in CDr. Abhineet Anand
10.2K views31 Folien
INLINE FUNCTION IN C++ von
INLINE FUNCTION IN C++INLINE FUNCTION IN C++
INLINE FUNCTION IN C++Vraj Patel
6K views13 Folien
Function overloading ppt von
Function overloading pptFunction overloading ppt
Function overloading pptProf. Dr. K. Adisesha
781 views17 Folien
Functions in c++ von
Functions in c++Functions in c++
Functions in c++Rokonuzzaman Rony
1.3K views25 Folien
Data types von
Data typesData types
Data typesZahid Hussain
29.5K views20 Folien

Was ist angesagt?(20)

Function overloading(c++) von Ritika Sharma
Function overloading(c++)Function overloading(c++)
Function overloading(c++)
Ritika Sharma14.6K views
INLINE FUNCTION IN C++ von Vraj Patel
INLINE FUNCTION IN C++INLINE FUNCTION IN C++
INLINE FUNCTION IN C++
Vraj Patel6K views
Presentation on Function in C Programming von Shuvongkor Barman
Presentation on Function in C ProgrammingPresentation on Function in C Programming
Presentation on Function in C Programming
Shuvongkor Barman14.6K views
Variables in C Programming von programming9
Variables in C ProgrammingVariables in C Programming
Variables in C Programming
programming99.1K views
RECURSION IN C von v_jk
RECURSION IN C RECURSION IN C
RECURSION IN C
v_jk14.1K views
Operators and expressions in c language von tanmaymodi4
Operators and expressions in c languageOperators and expressions in c language
Operators and expressions in c language
tanmaymodi42.3K views
array of object pointer in c++ von Arpita Patel
array of object pointer in c++array of object pointer in c++
array of object pointer in c++
Arpita Patel800 views
Command line arguments von Ashok Raj
Command line argumentsCommand line arguments
Command line arguments
Ashok Raj2.1K views

Destacado

C Programming von
C ProgrammingC Programming
C ProgrammingAdil Jafri
4.6K views71 Folien
Important C program of Balagurusamy Book von
Important C program of Balagurusamy BookImportant C program of Balagurusamy Book
Important C program of Balagurusamy BookAbir Hossain
1.8K views11 Folien
C programs von
C programsC programs
C programsMinu S
8.5K views181 Folien
20 C programs von
20 C programs20 C programs
20 C programsnavjoth
5.4K views25 Folien
Continuing Professional Development (CPD) von
Continuing Professional Development (CPD)Continuing Professional Development (CPD)
Continuing Professional Development (CPD)European Industrial Pharmacists Group
1.9K views10 Folien

Destacado(20)

C Programming von Adil Jafri
C ProgrammingC Programming
C Programming
Adil Jafri4.6K views
Important C program of Balagurusamy Book von Abir Hossain
Important C program of Balagurusamy BookImportant C program of Balagurusamy Book
Important C program of Balagurusamy Book
Abir Hossain1.8K views
C programs von Minu S
C programsC programs
C programs
Minu S8.5K views
20 C programs von navjoth
20 C programs20 C programs
20 C programs
navjoth5.4K views
Grocery Mangement Project in C von Mahmudul Alam
Grocery Mangement Project in CGrocery Mangement Project in C
Grocery Mangement Project in C
Mahmudul Alam5.4K views
Introduction to C Language von Kamal Acharya
Introduction to C LanguageIntroduction to C Language
Introduction to C Language
Kamal Acharya1.6K views
File handling in c von Vikash Dhal
File handling in c File handling in c
File handling in c
Vikash Dhal5.1K views
How c program execute in c program von Rumman Ansari
How c program execute in c program How c program execute in c program
How c program execute in c program
Rumman Ansari741 views
Structure of c_program_to_input_output von Anil Dutt
Structure of c_program_to_input_outputStructure of c_program_to_input_output
Structure of c_program_to_input_output
Anil Dutt1.3K views
Introduction to c programming language von sanjay joshi
Introduction to c programming languageIntroduction to c programming language
Introduction to c programming language
sanjay joshi7K views
16717 functions in C++ von LPU
16717 functions in C++16717 functions in C++
16717 functions in C++
LPU4.9K views
Introduction to C Language von Tarun Sharma
Introduction to C LanguageIntroduction to C Language
Introduction to C Language
Tarun Sharma1.4K views
Microcontroller Based Medicine Reminder von Ronak047
Microcontroller Based Medicine ReminderMicrocontroller Based Medicine Reminder
Microcontroller Based Medicine Reminder
Ronak04710.2K views

Similar a Function

functionsinc-130108032745-phpapp01.pdf von
functionsinc-130108032745-phpapp01.pdffunctionsinc-130108032745-phpapp01.pdf
functionsinc-130108032745-phpapp01.pdfmounikanarra3
1 view14 Folien
Unit_5Functionspptx__2022_12_27_10_47_17 (1).pptx von
Unit_5Functionspptx__2022_12_27_10_47_17 (1).pptxUnit_5Functionspptx__2022_12_27_10_47_17 (1).pptx
Unit_5Functionspptx__2022_12_27_10_47_17 (1).pptxvekariyakashyap
13 views27 Folien
Unit 3 (1) von
Unit 3 (1)Unit 3 (1)
Unit 3 (1)Sowri Rajan
17 views28 Folien
unit_2.pptx von
unit_2.pptxunit_2.pptx
unit_2.pptxVenkatesh Goud
8 views61 Folien
C function von
C functionC function
C functionthirumalaikumar3
494 views26 Folien
Function in c von
Function in cFunction in c
Function in cCGC Technical campus,Mohali
658 views22 Folien

Similar a Function(20)

functionsinc-130108032745-phpapp01.pdf von mounikanarra3
functionsinc-130108032745-phpapp01.pdffunctionsinc-130108032745-phpapp01.pdf
functionsinc-130108032745-phpapp01.pdf
mounikanarra31 view
Unit_5Functionspptx__2022_12_27_10_47_17 (1).pptx von vekariyakashyap
Unit_5Functionspptx__2022_12_27_10_47_17 (1).pptxUnit_5Functionspptx__2022_12_27_10_47_17 (1).pptx
Unit_5Functionspptx__2022_12_27_10_47_17 (1).pptx
vekariyakashyap13 views
Dti2143 chapter 5 von alish sha
Dti2143 chapter 5Dti2143 chapter 5
Dti2143 chapter 5
alish sha736 views
CH.4FUNCTIONS IN C_FYBSC(CS).pptx von SangeetaBorde3
CH.4FUNCTIONS IN C_FYBSC(CS).pptxCH.4FUNCTIONS IN C_FYBSC(CS).pptx
CH.4FUNCTIONS IN C_FYBSC(CS).pptx
SangeetaBorde329 views
USER DEFINED FUNCTIONS IN C.pdf von BoomBoomers
USER DEFINED FUNCTIONS IN C.pdfUSER DEFINED FUNCTIONS IN C.pdf
USER DEFINED FUNCTIONS IN C.pdf
BoomBoomers104 views
Presentation on function von Abu Zaman
Presentation on functionPresentation on function
Presentation on function
Abu Zaman11.2K views
C Programming Language Part 7 von Rumman Ansari
C Programming Language Part 7C Programming Language Part 7
C Programming Language Part 7
Rumman Ansari465 views

Último

Thanksgiving!.pdf von
Thanksgiving!.pdfThanksgiving!.pdf
Thanksgiving!.pdfEnglishCEIPdeSigeiro
264 views17 Folien
REPRESENTATION - GAUNTLET.pptx von
REPRESENTATION - GAUNTLET.pptxREPRESENTATION - GAUNTLET.pptx
REPRESENTATION - GAUNTLET.pptxiammrhaywood
138 views26 Folien
ICS3211_lecture 09_2023.pdf von
ICS3211_lecture 09_2023.pdfICS3211_lecture 09_2023.pdf
ICS3211_lecture 09_2023.pdfVanessa Camilleri
115 views10 Folien
Use of Probiotics in Aquaculture.pptx von
Use of Probiotics in Aquaculture.pptxUse of Probiotics in Aquaculture.pptx
Use of Probiotics in Aquaculture.pptxAKSHAY MANDAL
119 views15 Folien
Computer Introduction-Lecture06 von
Computer Introduction-Lecture06Computer Introduction-Lecture06
Computer Introduction-Lecture06Dr. Mazin Mohamed alkathiri
105 views12 Folien
Structure and Functions of Cell.pdf von
Structure and Functions of Cell.pdfStructure and Functions of Cell.pdf
Structure and Functions of Cell.pdfNithya Murugan
719 views10 Folien

Último(20)

REPRESENTATION - GAUNTLET.pptx von iammrhaywood
REPRESENTATION - GAUNTLET.pptxREPRESENTATION - GAUNTLET.pptx
REPRESENTATION - GAUNTLET.pptx
iammrhaywood138 views
Use of Probiotics in Aquaculture.pptx von AKSHAY MANDAL
Use of Probiotics in Aquaculture.pptxUse of Probiotics in Aquaculture.pptx
Use of Probiotics in Aquaculture.pptx
AKSHAY MANDAL119 views
Structure and Functions of Cell.pdf von Nithya Murugan
Structure and Functions of Cell.pdfStructure and Functions of Cell.pdf
Structure and Functions of Cell.pdf
Nithya Murugan719 views
AUDIENCE - BANDURA.pptx von iammrhaywood
AUDIENCE - BANDURA.pptxAUDIENCE - BANDURA.pptx
AUDIENCE - BANDURA.pptx
iammrhaywood117 views
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB... von Nguyen Thanh Tu Collection
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
CUNY IT Picciano.pptx von apicciano
CUNY IT Picciano.pptxCUNY IT Picciano.pptx
CUNY IT Picciano.pptx
apicciano54 views
Pharmaceutical Inorganic Chemistry Unit IVMiscellaneous compounds Expectorant... von Ms. Pooja Bhandare
Pharmaceutical Inorganic Chemistry Unit IVMiscellaneous compounds Expectorant...Pharmaceutical Inorganic Chemistry Unit IVMiscellaneous compounds Expectorant...
Pharmaceutical Inorganic Chemistry Unit IVMiscellaneous compounds Expectorant...
Ms. Pooja Bhandare133 views
Sociology KS5 von WestHatch
Sociology KS5Sociology KS5
Sociology KS5
WestHatch85 views
EIT-Digital_Spohrer_AI_Intro 20231128 v1.pptx von ISSIP
EIT-Digital_Spohrer_AI_Intro 20231128 v1.pptxEIT-Digital_Spohrer_AI_Intro 20231128 v1.pptx
EIT-Digital_Spohrer_AI_Intro 20231128 v1.pptx
ISSIP386 views
Pharmaceutical Inorganic chemistry UNIT-V Radiopharmaceutical.pptx von Ms. Pooja Bhandare
Pharmaceutical Inorganic chemistry UNIT-V Radiopharmaceutical.pptxPharmaceutical Inorganic chemistry UNIT-V Radiopharmaceutical.pptx
Pharmaceutical Inorganic chemistry UNIT-V Radiopharmaceutical.pptx
Ms. Pooja Bhandare113 views
Ch. 8 Political Party and Party System.pptx von Rommel Regala
Ch. 8 Political Party and Party System.pptxCh. 8 Political Party and Party System.pptx
Ch. 8 Political Party and Party System.pptx
Rommel Regala54 views

Function

  • 1. Presentation on function in 'c-language' by- Sanju & Amit
  • 2. function Defination:- function is a self-contained block of program that performs a coherent task of some kinds. Function is also called as modular programming.
  • 3.
  • 5.
  • 7.
  • 8.
  • 10. Function call A  function call  is an expression containing a simple type name and a parenthesized argument list. The argument list can contain any number of expressions separated by commas. It can also be empty. For example: res= sum ( a , b); prime(&no);
  • 11. Function definition In C user- written functions should normally be declared prior to its use to allow compiler to perform type checking on arguments used in its call statement. Syntex- Return_data_type function_name (data_type Var_name, …..);
  • 12.
  • 13.
  • 14.
  • 15. it tells it how many parameters there are.
  • 16. Argument – passing of values b/w the main program and the function takes place through arguments. Formal and actual argument- The actual arguments are the arguments with which the function can be called. Simply function call contains actual arguments. // Call func with actual arguments i and j. func( i, j ); -The formal arguments are the arguments with which the function can be defined. function defination contains formal arguments void Func( int i ); // Function prototype … Func( 7 ); // Execute function call
  • 17. CALL BY VALUE AND CALL BY REFERENCE   Call by value- Whenever  we called a function and passed something to it we have always passed the ‘values’ of variables to the called function. Such function calls are called ‘calls by value. in this context we are working on copies of actual argument.
  • 18.
  • 19. swap ( int x, int y )
  • 20. {
  • 22. t = x ;
  • 23. x = y ;
  • 24. y = t ;
  • 25. printf ( &quot; x = %d y = %d&quot;, x, y ) ;
  • 26. }
  • 27. The output of the above program would be:
  • 28. x = 20 y = 10
  • 29. Call by refrence- An  argument passing convention where the address of an argument variable  is passed to a  function  or  procedure as opposed to passing the value of the argument expression. 
  • 30. Int sum(int *,int *); void main() { int i=10, j=20; K=sum(&i,&j); Printf(“%d”,k); } Int sum(int *a, int *b) { int c; C=*a+*b; return( c ); }
  • 31. Recursion A function is called recursive if a statement with in the body of the function calls the same function. Sometimes called circular definition. Recursion is thus the process of defining something in terms of itself.
  • 32. Main() { int a, fact; printf(“ enter any number”); Scanf(“%d”, &a); fact = rec (a); Printf(“factorial value=%d”,fact); } int rec (int x) { int f ; if (x==1) return(1); else f=x*rec(x-1); return (f); }
  • 33.
  • 34.
  • 35. It also reduces the Time to run a program. In other way,Its directly proportional to Complexity.
  • 36. Its easy to find-out the errors due to the blocks made as function definition outside the main function.
  • 37. Return statement The return statement terminates the execution of a function and returns control to the calling function. Execution resumes in the calling function at the point immediately following the call. r eturn expression ; return; The default return type is int.

Hinweis der Redaktion

  1. 1. INTRODUCTION   Information and communication technology (ICTs) are playing an increasingly vital role in the daily Lives of people, revolutionizing work and leisure and changing the rules of doing business. In the Realm of government, ICT applications are promising to enhance the delivery of public goods and services to citizens not only by improving the process and management of government, but also by redefining the traditional concepts of citizenship and democracy. Reforms are necessary in any country, any society. They are an indicator of a progressive people, bent upon fine-tuning their own governance and upkeep.   E-governance or electronic governance may be defined as delivery of government services and information to the public using electronic means. E governance to implement citizen-IT based application in the RTO (regional transport office) is the next logical step. As regional transport office is (RTO) one of the government department having the higher interaction with the citizens and as the density of vehicles as has shown an exponential growth in last few years, IT industry application will help to overcome the problem of the existing system and provide “fast and quality services” to the customers.   The facility is designed as a centralized monitoring system, wherein the action from the entire district licensing could be verified from the central administrator through the website itself .Under the system ,the district authority is able to avail details of the activities like the number of applications field for license total number of license issue ,license application on pending, reason for delay of process duration of licensing of process in each application and the no. of application rejected.   E-Governance focuses on-   Greater attention to improve services delivery mechanism. Enhancing the efficiency of production. Emphasis upon the wider access of information.
  2. The facility is designed as a centralized monitoring system, wherein the action from the entire district licensing could be verified from the central administrator through the website itself .Under the system ,the district authority is able to avail details of the activities like the number of applications field for license total number of license issue ,license application on pending, reason for delay of process duration of licensing of process in each application and the no. of application rejected.   E-Governance focuses on-   Greater attention to improve services delivery mechanism. Enhancing the efficiency of production. Emphasis upon the wider access of information.
  3. The following procedure our to undergo for license which are quite unpredictable and time consuming and require a lot of paper work which is tedious and checks a customer patience. These can be overcome if all the works are undergo through a computerized. Process, which will reduce paper work as well as human efforts.    
  4. AGE LIMIT FOR OBTAINING A DRIVING LICENCE Motor Cycles with Gear - 18 Yrs &amp; Above   Motor Cycles without Gear  - 16 Yrs &amp; Above   Private Light Motor Vehicles - 18 Yrs &amp; Above   Transport Vehicles - 20 Yrs &amp; Above      
  5.   The importance of the system is concerned according to the class of user which is going to use the system. The following type of user as follows:-   As per the citizens: This system is important for citizens due to following reason: Even an unregistered user can get a brief idea about the procedure followed for issuing of the License. A registered user can apply for issuing of learning License by providing the required credentials and paying the required money. Registered user need to undergo a test which is conducted online and it is mandatory for him to clear the test in order to prove his eligibility for earning a permanent License.   As per the Government Representatives: This system is important for the officials working in the RTO due to following reason: Pace up with the economic globalization. Helps to reduce the paperwork. No fear of going through hundred of files to check single application. Reliable way of testing the knowledge of the applicant by conducting an automated test. An application cannot remain unnoticed for a very long period.  
  6. BASIC ARCHITECTURE   Architecture   Database – This is the backbone or the back end. Three databases namely DB2 version 7.2 or higher, oracle 8i and version 8.1.6 or higher and MySQL Server 2000 or higher can be used for storing all the data about the transactions undertaken for future use.   Application server – This is the middle layer which manages the business rules that manipulates the data as per the governing condition of the applications. It provides a database independent interface for applications and makes the front end robust. This application uses the JAVA RMI framework or ASP.NET programs to establish connection to client. This feature enables a program running on the client computer to make method calls on an object located on a remote server machine.   Client- The presentation and control logic embedded in the client tier. This is the GUI layer of the application using swing component of JAVA , which will interact with the application server by means of forms.   BASIC ARCHITECTURE   Architecture   Database – This is the backbone or the back end. Three databases namely DB2 version 7.2 or higher, oracle 8i and version 8.1.6 or higher and MySQL Server 2000 or higher can be used for storing all the data about the transactions undertaken for future use.   Application server – This is the middle layer which manages the business rules that manipulates the data as per the governing condition of the applications. It provides a database independent interface for applications and makes the front end robust. This application uses the JAVA RMI framework or ASP.NET programs to establish connection to client. This feature enables a program running on the client computer to make method calls on an object located on a remote server machine.   Client- The presentation and control logic embedded in the client tier. This is the GUI layer of the application using swing component of JAVA , which will interact with the application server by means of forms.   BASIC ARCHITECTURE   Architecture   Database – This is the backbone or the back end. Three databases namely DB2 version 7.2 or higher, oracle 8i and version 8.1.6 or higher and MySQL Server 2000 or higher can be used for storing all the data about the transactions undertaken for future use.   Application server – This is the middle layer which manages the business rules that manipulates the data as per the governing condition of the applications. It provides a database independent interface for applications and makes the front end robust. This application uses the JAVA RMI framework or ASP.NET programs to establish connection to client. This feature enables a program running on the client computer to make method calls on an object located on a remote server machine.   Client- The presentation and control logic embedded in the client tier. This is the GUI layer of the application using swing component of JAVA , which will interact with the application server by means of forms.