GoConqr hat ein neues Design! Sag uns, wie es dir gefällt.

Karteikarten

FUNCTIONS

Xeenat S Computer Science Englisch 4 Karten

Karten in diesem Stapel (4)

  1. 1In 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);
  2. 2A 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.
  3. 3The 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.
  4. 4The 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.

Informationen

Beschreibung
C - PROGRAMMING FUNCTIONS
Erstellt von
Xeenat S
Aufrufe
11
Bewertung

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck