Passing Pointers as Function Argument in C

In C language we can pass the pointer as an function argument. To do so we have to declare the function parameter as a pointer type.
void MyFunc(int *ptr);
And also note that at the time of function call we need to put the address of ( & ) operator within the argument provided to the function.
Example :

void printNum(int *ptr);

int main() {
  int n = 10;
  return 0;

void printNum(int *ptr) {
  printf("%d\n", *ptr);
Output :


Next Topic :