+ 1

Cosine(x)

https://code.sololearn.com/cvtNfKDrk4zg/?ref=app here there is a code for cosine, but there is a mistake in calling the class... Can u help please?..

31st Dec 2020, 10:51 AM
🏐Volley
🏐Volley - avatar
2 odpowiedzi
+ 3
malloc() returns a pointer, so you would have to adjust the type of "objs" to myCosine* (the same applies to the explicit cast to the returned value). It should also be noted that you access the array far out of its bounds, which is undefined behaviour. However, since the size of "objs" is known at compile time, you can allocate the array on the stack instead and avoid malloc(). Here is how you could rewrite it: https://code.sololearn.com/c4PRr0YRx97q/?ref=app
31st Dec 2020, 11:04 AM
Shadow
Shadow - avatar
+ 1
Thanks Shadow for your great help. You saved my time in figuring it out😊😊✨
31st Dec 2020, 11:08 AM
🏐Volley
🏐Volley - avatar