## Differences Between Formal Arguments and Actual Arguments of a Function

by Dinesh Thakur Category: Function and Pointer

Argument: An argument is an expression which is passed to a function by its caller (or macro by its invoker) in order for the function(or macro) to perform its task. It is an expression in the comma-separated list bound by the parentheses in a function call expression.

## C Program Calculate area and circumference of a circle using functions

by Dinesh Thakur Category: Function and Pointer

Let us write a program to calculate the area' and circumference of a circle using user-defined functions. A function area_circum to accept the radius of a circle and print its area and circumference is given in Example. However, rather than printing the results in a function, it is good practice to return the results to the calling function, where they can be printed or used for further processing, if required. Hence, let us return the results (area and circumference) to the calling function.

## Type Casting Of Pointers in C

by Dinesh Thakur Category: Function and Pointer

We saw that pointer values may be assigned to pointers of same type. However, pointers may be type cast from one type to another type. In the following code lines, A is an int type variable, D is variable of type double, and ch is a variable of type char. Pa is declared as a pointer to int variables, Pd is declared as a pointer to double type variables, and Pc is declared as pointer to character type variables. Pa is assigned the value &A.

## What is the purpose of main() function

by Dinesh Thakur Category: Function and Pointer

In C, program execution starts from the main() function. Every C program must contain a main() function. The main function may contain any number of statements. These statements are executed sequentially in the order which they are written.

## Explain command line arguments of main function

by Dinesh Thakur Category: Function and Pointer

In C, we can supply arguments to 'main' function. The arguments that we pass to main ( ) at command prompt are called command line arguments. These arguments are supplied at the time of invoking the program.

## Advantages of Functions in C

by Dinesh Thakur Category: Function and Pointer

Recall that a function call takes the form

func_ name ( arg_list )

## pass by value and pass by reference in functions

by Dinesh Thakur Category: Function and Pointer

Pass by Value: In this method, the value of each of the actual arguments in the calling function is copied into corresponding formal arguments of the called function. In pass by value, the changes made to formal arguments in the called function have no effect on the values of actual arguments in the calling function.

## What is Functions ? Type of Function

by Dinesh Thakur Category: Function and Pointer

It would not be wrong to say that C language is a function-based language. The C Standard Library contains a large number of predefined functions which may be called in programs for carrying out various processes. Related functions are grouped together under various header files.

## What is the difference between goto and longjmp() and setjmp()

by Dinesh Thakur Category: Function and Pointer

A goto statement implements a local jump of program execution, and the longjmp() and setjmp() functions implement a nonlocal, or far, jump of program execution. Generally, a jump in execution of any kind should be avoided because it is not considered good programming practice to use such statements as goto and longjmp in your program.

## What is Pointers in C

by Dinesh Thakur Category: Function and Pointer

pointer is a very powerful and sophisticated feature provided in the C language. A variable defined in a program the compiler allocates a space in the memory to store its value. The number of bytes allocated to the variable depends on its type. For instance, a character is allocated 1 byte, an int is, in general, allocated 4 bytes, and a float is also allocated 4 bytes on a typical 32-bit system. The memory in RAM is grouped into bytes; each byte has 8 bits of memory. Bytes are sequentially numbered. Thus, each byte is associated with a number which is its address. When a variable is declared, a block of memory is allocated to store its value. The address of a variable is the byte number of the first byte of the memory block allocated for value storage. The value of a pointer to the variable is also the address where the value is stored, i.e., its value is the byte number of the first byte of the memory block where the value of variable is stored. A pointer to a data item is nothing but the address of that data item. Address of a variable may be determined by application of address-of operator (&).We can store this address in a variable, called the pointer variable, and use it to manipulate that data item. For instance, let Marks be a variable of type int. On a 32-bit system, Marks would be allocated a memory block of size 4 bytes for storing its value.

Page 1 of 8

Dinesh 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.

Related Articles