Passing Pointer Array to Function in C

Passing Pointer Array to Function in C. In c, passing an int pointer to a function. A function is a set of statements that work together to complete a mission. A pointer is a variable whose value is the address of another variable that is the memory location’s direct address.

#include<stdio.h>
int func(int a, int b) 
{
printf("\n\n a = %d \n", a);
printf("\n\n b = %d \n", b);
}
int main()
{
int(*fptr)(int , int);
fptr = func;
func(5,6);
fptr(7,8); 
return 0;
}

 

Output:

a = 5

b = 6

a = 7

b = 8

Pointer in C Program

In C, a pointer is a variable that keeps track of the address of another variable. A pointer can also be used to refer to the function of another pointer. A pointer can be increased or decreased, pointing to the next or previous memory location. The purpose of a pointer is to save memory and speed up the execution process.

Return Statement in C

A return statement instructs the program to exit the current function and resume execution at the point in the code immediately following the function’s call. Return statements allow a function to specify a return value that will be passed back to the code that called the function in many languages.

Function for Passing Pointers to Functions in C

A function is a collection of statements that work together to complete a task. The name, return type, and parameters of a function are all specified in a function declaration. The body of the function is defined by a function definition. The C standard library includes a number of built-in functions that you can use in your program. Passing Pointers to Functions in C for beginners to understand the basics.