Really sorry to bump it, I finally found the problem of the RTE. I did get some extra help but yeah my code for deleting a node was accessing stuff from null pointer. I'll post the correct code in...
Type: Posts; User: Iiz
Really sorry to bump it, I finally found the problem of the RTE. I did get some extra help but yeah my code for deleting a node was accessing stuff from null pointer. I'll post the correct code in...
@flip1969 and @Niccolo Thanks a lot to both of you. I didn't know that -> operator had precedence over * till now. There were few logical errors in my code too but I think I cleaned it up. I was...
Hello all this is my code:
#include <stdio.h>
#include <stdlib.h>
struct Node
{
int data;
struct Node* prev;
struct Node* next;
};
Nah, it's fine. You're helping people voluntarily it's ok to get angry ^^
Anyway, I am posting a screenshot that my program worked. Idk what are the policies of this site but sharing solved code...
oh.
Really sorry to be a bother and getting on your nerves. I'll try to fix the malloc problem soon but for now, the problem didn't really need a dynamic allocation. I'll surely update it and in due...
So, I am supposed to think of getting the desired output without storing the input? Or by only partially storing the input?
EDIT1 - I rethought my approach to this problem as Salem said....
I know I am being unreasonable when the constraints are so huge but that's what's given as constraints. Here's a screenshot:
15194
Sorry, I forgot to add sample input and output.
Input:
4
65...
I think I've got the logic of the problem correctly(although a bit messy)
Initally, I had done this with static variable of size 10 but the challenge is to take very large inputs (upto 10^100) so...
I think I somehow get it, I'll look over it. For now, it's working. I have not freed the memory arr takes but I don't think it'll cause any problem. Thanks, is there any way to mark it solved in here?
Now for sure, I can say it's working. Whew, so why was it not working before and skipping the last term? i<c-1 means that second last element right? What was I not taking into account?
Do you mean i<c-1 ? I don't get this part at all. c<c-1 doesn't help, neither dose changing it to i<c-1. Why isn't it actually printing the last element?
Ahhh, it's working now. I ran the loop to c-1 and changed the allocation to k+1, I forgot initially k was 0. Not tried to remove the recast thing yet. I can now free the old arr without any problem...
Augh, I am so stupid this is my previous code which had the realloc mistake. Could you kindly check this one instead:
#include <stdio.h>#include <stdlib.h>
struct poly
{
float exp;
...
Of course we can compare two similar numbers, you're absolutely correct when nums[inner]=nums[outer]=nums[0], basically it's comparing the same number so the if would return a false in this case. Try...
Thanks for your input but I don't want to create more structures. Basically, I don't need to differentiate the polynomials when I am going to add them. Also when I read the polynomial terms I use a...
Hello, I am trying to write a simple program where I want to find sum of polynomials. I've found out the my code is somewhere wrong during the sorting step using valgrind but I don't know why? Could...
C does not have an array bound checking so even if you create an array of size 1, it will show no error in accepting hundreds of characters/data. But you might not be able to access them since...