by Dinesh Thakur Category: Function and Pointer

It accepts three parameters  x,y, and z, each of type double and returns a value of type double.

 
by Dinesh Thakur Category: Function and Pointer

The values of pointer variables are unsigned integer numbers which are addresses of other variables. An unsigned integer is allocated 4 bytes of memory for its storage on a typical 32-bit system. Thus, pointers to all types of data occupy the same size of memory because the value of a pointer is the memory address - an unsigned integer. However, the variables to which the pointers point to, of course, occupy different sizes of memory blocks according to their types.

 
by Dinesh Thakur Category: Function and Pointer

We have studied that an array is a powerful built-in data structure in the C language. It is a collection of data items of the same type stored in consecutive memory locations. An element of an array can be accessed using subscript notation, as in a [i ] , b [ i ] [ j ] , etc. Also, we can process entire arrays using loops and pass them to functions.

 
by Dinesh Thakur Category: Function and Pointer

An individual element of an array may be regarded as a variable of the type declared in the declaration of the array. All the operators that can be applied to a variable of that type are applicable to the elements of array as well. Program, the array elements are subjected to arithmetic operations with the help of pointers.

 
by Dinesh Thakur Category: Function and Pointer

A function definition comprises a head (or header) and a body. The header gives the information about type of function, name of function, and a list of parameters. The list of parameters comprises types and names of parameters enclosed in parentheses and separated by commas. An illustration of function definition is given below.



 
by Dinesh Thakur Category: Function and Pointer

String concatenation is another basic string manipulation operation. In this, all the characters in a string, including the null terminator, are appended to the target string (i. e., copied at the end) replacing the null terminator in it. Thus, after the concatenation operation, the target string contains all the characters originally contained in it followed by those in the appended string. For example, if string sl contains "Pine" and string s2 contains "apple", then appending string s2 to sl modifies string sl to "Pineapple". Note that sl must have enough character positions to accommodate all the appended characters, including the null terminator.

 
by Dinesh Thakur Category: Function and Pointer

A function is a subprogram that is used to perform a predefined operation and optionally return a value. Using functions, we can avoid repetitive coding in programs and simplify as well as speed up program development.

 
by Dinesh Thakur Category: Function and Pointer

We know that when a function is called, the parameters are passed to it by value, i.e., the values of arguments in a function call are copied to the parameters of the called function. Since a function parameter is a copy of the argument variable and is local to the function, any change in its value in the body of the function modifies only the local copy and not the corresponding argument in the calling function.

 
by Dinesh Thakur Category: Function and Pointer

Before a function is called in a program, the system should know where to look for the function definition. In case of functions belonging to C standard library we include the relevant header files in which the function is defined. This is done above the main() function. In case of user-defined functions, a function may be defined above or below the main function, because, a function cannot be defined inside another function. If a function is defined above the main function, there is no need of a separate declaration of function. However, if the function is defined below the main function, it is a good programming practice to declare the functions being used above the main. A function declaration may be done by the function header or by its prototype.

 
by Dinesh Thakur Category: Function and Pointer

Sometimes we may want that a function should not modify the value of a parameter passed to it, either directly within that function or indirectly in some other function called form it. This can be achieved using const parameters. Consider, for example, the function given below to calculate the sum of the first n integer numbers.

 

Page 5 of 8

About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.



Search Content







Popular Article