1// passing a pointer to function in C
2// It increaments the salary of an employee
3
4
5#include <stdio.h>
6void salaryhike(int *var, int b)
7{
8 *var = *var+b;
9}
10int main()
11{
12 int salary=0, bonus=0;
13 printf("Enter the employee current salary:");
14 scanf("%d", &salary);
15 printf("Enter bonus:");
16 scanf("%d", &bonus);
17 salaryhike(&salary, bonus);
18 printf("Final salary: %d", salary);
19 return 0;
20}
1#include <stdio.h>
2#include <stdlib.h>
3#include <math.h>
4void add(int* a, int* b, int* c)
5{
6 *c = *a + *b;
7}
8int main()
9{
10 int a, b, c;
11 a = 3;
12 b = 5;
13 add(&a, &b, &c);
14 printf("%d", c);
15}
1/**
2* myFunction - a function that recieves an integer pointer
3*/
4
5void myFunction(int *param) {
6 .
7 .
8 .
9}