• ¿Documento equivocado? Cámbialo gratis
  • Escrito por estudiantes que aprobaron
  • Inmediatamente disponible después del pago
  • Leer en línea o como PDF
Vender
¿Dónde estudias?
Tu idioma
Document preview thumbnail
Vista previa 3 fuera de 24 páginas
Examen

Functions and Pointers – Programming Study Guide and Practice Questions with Answers

Document preview thumbnail
Vista previa 3 fuera de 24 páginas

Functions and Pointers – Programming Study Guide and Practice Questions with Answers

Vista previa del contenido

_()()(_(()*)()(*)(Functions
Functions)__*_()()(_(()*)()(*)(Functions
& Pointers.pdf10/23/2026,
& Pointers.pdf10/23/2026,
8:13:01
& Pointers.pdf10/23/2026,
AM*@*^%^#!*&^*&^!()(@*&$*@10/23/2026,
8:13:01 AM*@*^%^#!*&^*&^!()(@*&$*@10/23/2026,
8:13:01 AM*@*^%^#!*&^*&^!()(@*&$*@10/23/2026,
4:03:13 AM1 of
4:03:13
24PageAM1
1Functions
of
4:03:13
24Page&AM1
Pointers.pdf2026/10/23Page
1Functions
of 24Page& Pointers.pdf2026/10/23Page
1Functions & Pointers.pdf2026
1 of 24 1




Functions & Pointers
Functions And Pointers
• Functions are created when the same process or an algorithm to be repeated several times
in various places in the program.
• Function has a self-contained block of code, that executes certain task. A function has a
name, a list of arguments which it takes when called, and the block of code it executes when
called.
• Functions are two types:
1. Built-in / Library function.
Example: printf(), scanf(), getch(), exit(), etc.
2. User defined function.
User-Defined Functions
Functions defined by the users according to their requirements are called user-defined functions.
These functions are used to break down a large program into a small functions.
Advantage of User defined function:
1. Reduce the source code
2. Easy to maintain and modify
3. It can be called anywhere in the program.
Body of user defined function:
return_type f_name (argument1,argument 2)
{
local variables;
statements;
return_type;
}




_()()(_(()*)()(*)(Functions
Functions)__*_()()(_(()*)()(*)(Functions
& Pointers.pdf10/23/2026,
& Pointers.pdf10/23/2026,
8:13:01
& Pointers.pdf10/23/2026,
AM*@*^%^#!*&^*&^!()(@*&$*@10/23/2026,
8:13:01 AM*@*^%^#!*&^*&^!()(@*&$*@10/23/2026,
8:13:01 AM*@*^%^#!*&^*&^!()(@*&$*@10/23/2026,
4:03:13 AM1 of
4:03:13
24PageAM1
1Functions
of
4:03:13
24Page&AM1
Pointers.pdf2026/10/23Page
1Functions
of 24Page& Pointers.pdf2026/10/23Page
1Functions & Pointers.pdf2026
1 of 24 1

,_()()(_(()*)()(*)(Functions
Functions)__*_()()(_(()*)()(*)(Functions
& Pointers.pdf10/23/2026,
& Pointers.pdf10/23/2026,
8:13:01
& Pointers.pdf10/23/2026,
AM*@*^%^#!*&^*&^!()(@*&$*@10/23/2026,
8:13:01 AM*@*^%^#!*&^*&^!()(@*&$*@10/23/2026,
8:13:01 AM*@*^%^#!*&^*&^!()(@*&$*@10/23/2026,
4:03:13 AM2 of
4:03:13
24PageAM2
2Functions
of
4:03:13
24Page&AM2
Pointers.pdf2026/10/23Page
2Functions
of 24Page& Pointers.pdf2026/10/23Page
2Functions & Pointers.pdf2026
2 of 24 2




The body of user-defined shows that an user-defined functions has following characteristics:
1. Return type
2. Function name
3. Parameter list of arguments
4. Local variables
5. Statements
6. Return value


S.No C function aspects Syntax
1 function definition return_type function_name ( arguments list )
{ Body of function; }
2 function call function_name ( arguments list );
3 function declaration return_type function_name ( argument list );


Note: The function with return value must be the data type, that is return type and return value
must be of same data type.
User defined function has three parts:
1. Declaration part
ret_type f_name (arguments)
2. Calling part
f_name(arguments);




_()()(_(()*)()(*)(Functions
Functions)__*_()()(_(()*)()(*)(Functions
& Pointers.pdf10/23/2026,
& Pointers.pdf10/23/2026,
8:13:01
& Pointers.pdf10/23/2026,
AM*@*^%^#!*&^*&^!()(@*&$*@10/23/2026,
8:13:01 AM*@*^%^#!*&^*&^!()(@*&$*@10/23/2026,
8:13:01 AM*@*^%^#!*&^*&^!()(@*&$*@10/23/2026,
4:03:13 AM2 of
4:03:13
24PageAM2
2Functions
of
4:03:13
24Page&AM2
Pointers.pdf2026/10/23Page
2Functions
of 24Page& Pointers.pdf2026/10/23Page
2Functions & Pointers.pdf2026
2 of 24 2

,_()()(_(()*)()(*)(Functions
Functions)__*_()()(_(()*)()(*)(Functions
& Pointers.pdf10/23/2026,
& Pointers.pdf10/23/2026,
8:13:01
& Pointers.pdf10/23/2026,
AM*@*^%^#!*&^*&^!()(@*&$*@10/23/2026,
8:13:01 AM*@*^%^#!*&^*&^!()(@*&$*@10/23/2026,
8:13:01 AM*@*^%^#!*&^*&^!()(@*&$*@10/23/2026,
4:03:13 AM3 of
4:03:13
24PageAM3
3Functions
of
4:03:13
24Page&AM3
Pointers.pdf2026/10/23Page
3Functions
of 24Page& Pointers.pdf2026/10/23Page
3Functions & Pointers.pdf2026
3 of 24 3




3. Definition part
Function Parameters:
Parameters provide the data communication between calling function and called function.
Two types:
◻ Actual parameters:
These are the parameters transferred from the calling function[main function] to the called
function[user defined function].
◻ Formal parameters:
Passing the parameters from the called functions[user defined function] to the calling
functions[main function].
Note:
◻ Actual parameter– This is the argument which is used in function call.
◻ Formal parameter– This is the argument which is used in function definition.
Categories of User defined function/Function Prototypes:
• A function prototype declaration consists of the functions return type, name and
arguments list.
• Always terminated with semicolon.
The following are the function prototypes:
1. Function without return value and without argument.
2. Function without return value and with argument.
3. Function with return value and with argument.
4. Function with return value and without argument.
Note: Function with more than one return value will not have return type and return statement in
the function definition.
Consider the following example to multiply two numbers:
void main( )
{
int x,y,z;
scanf(―%d%d‖, &x,&y);
z=x* y;
printf(―The result is %d‖, z); }




_()()(_(()*)()(*)(Functions
Functions)__*_()()(_(()*)()(*)(Functions
& Pointers.pdf10/23/2026,
& Pointers.pdf10/23/2026,
8:13:01
& Pointers.pdf10/23/2026,
AM*@*^%^#!*&^*&^!()(@*&$*@10/23/2026,
8:13:01 AM*@*^%^#!*&^*&^!()(@*&$*@10/23/2026,
8:13:01 AM*@*^%^#!*&^*&^!()(@*&$*@10/23/2026,
4:03:13 AM3 of
4:03:13
24PageAM3
3Functions
of
4:03:13
24Page&AM3
Pointers.pdf2026/10/23Page
3Functions
of 24Page& Pointers.pdf2026/10/23Page
3Functions & Pointers.pdf2026
3 of 24 3

Información del documento

Subido en
23 de octubre de 2026
Número de páginas
24
Escrito en
2026/2027
Tipo
Examen
Contiene
Preguntas y respuestas
$10.99

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
Guider
4.7
(606)
Vendido
2001
Seguidores
2
Artículos
2039
Última venta
17 horas hace



Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes