+ 3

Where is the probleme here please!!!

https://code.sololearn.com/cn235GRd2nKy/?ref=app

27th Jun 2020, 9:02 PM
El Housyn Ait Khouya
El Housyn Ait Khouya - avatar
10 Answers
+ 6
As $¢𝐎₹𝔭!𝐨𝓝 posted link states strrev doesn't play nice. You can replace the line printf("%s",strrev(name)); with for(int l = strlen(name)-1;l >= 0; --l) printf("%c", name[l]); and it should work as expected.
27th Jun 2020, 9:59 PM
ChaoticDawg
ChaoticDawg - avatar
+ 4
~ swim ~ the issue with strrev goes beyond it being a non-standard function. It's fairly unstable. It's included here in SL in the string.h header, but doesn't work like it should 100% of the time. Just try running the OP's code several times and you'll see that it will work occasionally and then not work throwing an error the rest of the time.
28th Jun 2020, 2:57 AM
ChaoticDawg
ChaoticDawg - avatar
+ 4
~ swim ~ I would agree with that sentiment, but the fact that it will link, compile and run without error on occasion would indicate that there is more than just a function prototype in the header or linked to the header in the source code somewhere. If it were the case that it resulted in an error 100% of the time then that would give solid merit to what you're stating. To the best of my knowledge and experience, I've never seen a function be able to run with just a prototype and no function definition. If you could explain how this happens with a given degree of certainty and examples I'd certainly enjoy and appreciate the education. Note: As I was re-reading what I wrote in this post I felt it could be interpreted as being rude or snooty. Just to clarify, this is meant to be genuine and not a negative statement.
28th Jun 2020, 3:39 AM
ChaoticDawg
ChaoticDawg - avatar
+ 4
Yes, I can get it to work. Takes several tries though. I don't code much in C or C++ anymore (primarily Java and python, but have used pretty much all of them here minus ruby for personal and production projects) so, I don't currently use an IDE with either, but have used several in the past. I do understand the linking process, at least enough to grasp it, but admittedly I'm rusty when it comes to C/C++. I do however, have a pretty good foundation. I also understand that a project with just a prototype would compile just fine, but not run. This isn't what I'm saying. What I'm saying is that for whatever reason this function is unstable somehow, from what I can see, in the linking process. https://www.sololearn.com/post/451622/?ref=app
28th Jun 2020, 6:06 AM
ChaoticDawg
ChaoticDawg - avatar
+ 3
https://www.csestack.org/undefined-reference-to-strrev/#:~:text=Error%20message%20%E2%80%9CUndefined%20reference%20to%20strrev%E2%80%9D%3A&text=It's%20not%20about%20the%20system,error%20message%20as%20.
27th Jun 2020, 9:35 PM
$¢𝐎₹𝔭!𝐨𝓝
$¢𝐎₹𝔭!𝐨𝓝 - avatar
+ 1
ChaoticDawg yeah it's work thanks for help
28th Jun 2020, 9:48 AM
El Housyn Ait Khouya
El Housyn Ait Khouya - avatar