0

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

What is value of return ?

20th Jan 2021, 3:30 AM
Abhishek Kumar
Abhishek Kumar - avatar
4 Réponses
+ 3
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" .
20th Jan 2021, 3:31 AM
noteve
noteve - avatar
+ 2
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.
20th Jan 2021, 3:37 AM
noteve
noteve - avatar
0
What will be the value of integer?
20th Jan 2021, 3:36 AM
Abhishek Kumar
Abhishek Kumar - avatar
0
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; }
20th Jan 2021, 3:40 AM
Abhishek Kumar
Abhishek Kumar - avatar