FUNCTIONS

Descripción

C - PROGRAMMING FUNCTIONS
Xeenat S
Fichas por Xeenat S, actualizado hace más de 1 año
Xeenat S
Creado por Xeenat S hace más de 7 años
4
1

Resumen del Recurso

Pregunta Respuesta
In C, a function is an independent block of code that performs a specific task when called upon and it may return a value to the calling program. A function declaration/ function prototype specifies the name of the function, it's return type and a list of parameters. The general form of a function declaration is: return_type function_name(parameter_list);
A function may return one value at most. It specifies the type of value the function returns. If no value is to be returned, use 'void'. If the function doesn't have a return type, an integer value is presumed to be returned by the function. Function parameters are separated by a comma (,) and they are preceded by their type. If a function has no parameters, it's better to use 'void' between the parentheses (according to C Standard). If the parentheses are left empty, then the function takes any set of parameters instead of taking none.
The general form for a function definition is: return_type function_name(parameter_list) { /* Function Body */ } The function body is only executed when the function is called somewhere in the program. The execution of a function terminates if: either an exit statement (i.e. return) is called or it's last statement is executed.
The return value of a function has to match it's return type else, the compiler changes it to match the return type. A return value isn't required for a 'void' function. To indicate normal termination in main() function, use return 0. Any value other than 0 would mean an abnormal termination.
Mostrar resumen completo Ocultar resumen completo

Similar

Translations and transformations of functions
Christine Laurich
Computing Hardware - CPU and Memory
ollietablet123
SFDC App Builder 2
Parker Webb-Mitchell
Data Types
Jacob Sedore
Intake7 BIM L1
Stanley Chia
Software Processes
Nurul Aiman Abdu
Design Patterns
Erica Solum
CCNA Answers – CCNA Exam
Abdul Demir
Abstraction
Shannon Anderson-Rush
Spyware
Sam2
HTTPS explained with Carrier Pigeons
Shannon Anderson-Rush