1. Can we define a function with arguments as pointer as well as value??
I mean if a swap funcation is defined as :-
void swap(int num1 ,int*num2 );
is it correct to define like this??
Ans :-
Yes, we can. there is no issue in this case but as we know that the function does not allow to return values more than one. thus doing this wont change the value of num1 in the calling function and our main objective of swapping will remain incomplete.
I mean if a swap funcation is defined as :-
void swap(int num1 ,int*num2 );
is it correct to define like this??
Ans :-
Yes, we can. there is no issue in this case but as we know that the function does not allow to return values more than one. thus doing this wont change the value of num1 in the calling function and our main objective of swapping will remain incomplete.
No comments:
Post a Comment