int compare(char *s1,char *s2, int n) { return ...........; } | SoloLearn: Learn to code for FREE!


int compare(char *s1,char *s2, int n) { return ...........; }

What is value of return ?

c++ c

1/20/2021 3:30:42 AM

Abhishek Kumar

4 Answers

New Answer


Depends on the condition or requirements of the problem. or If you're asking about the data type then that should return an integer value because the function is declared as "int" .


Abhishek Kumar As I said, it depends on the challenge or problem. Or if you have your attempt then please show us you code and details of challenge so we my help. Thanks.


What will be the value of integer?


Below code is int main(){ char s1[20], s2[20]; int n,r; cin >> s1 >> s2 >> n; r = compare(s1,s2,n); if(r>0) cout << s1; else if(r<0) cout << s2; else cout << "equal"; return 0; }