Download presentation
Presentation is loading. Please wait.
Published byToby Ferguson Modified over 8 years ago
1
C allows programmer to define their own function according to their requirement. These types of functions are known as user-defined functions. Suppose, a programmer wants to find factorial of a number and check whether it is prime or not in same program. Then, he/she can create two separate user-defined functions in that program: one for finding factorial and other for checking whether it is prime or not. User-Defined Functions
2
Functions Syntax return_type function_name(type parameter1,type parameter2,…) { Process… } All functions are a functions like main function but there can be one and only one main function in a C program.
3
Function Types -Doesn’t take value and doesn’t return -Doesn’t take value but returns -Takes value but doesn’t return -Takes value and returns We use a code that return(variable); for functions that returns a value and after we use that code, function’s value is the variable that we wrote…
4
Functions that doesn’t take value and doesn’t return void function_name(void) { Process… }
6
Functions that doesn’t take value but returns int function_name(void) { Process… }
8
Functions that takes value but doesn’t return void function_name(int value1) { Process… }
10
Functions that takes value and returns int function_name(int value1) { Process… }
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.