0

Pointers on functins

Hey guys, how can i use pointers with functions?

22nd Feb 2019, 6:54 AM
Dark S
Dark S - avatar
1 Answer
+ 2
In the function prototype and function definition you can write int * in the parameters and in the int main you need to write address of operator that is & before the variable in the parentheses Like this int add(int *a,int *b) { return *a+*b; } int main() { //Some code c=add(&a,&b); //Some code }
22nd Feb 2019, 7:03 AM
Sahil Bhakat
Sahil Bhakat - avatar