So, I have been spoilt by python and am trying to pick up C again. I am getting this seg fault and I think I understand the reason but not sure on why it is happening.
long head = 1; // atleast that is what I was hoping for..
long *localranks = (long*) malloc(n * sizeof(long)); // size_t n = 50;
localranks[head] = 0; // seg fault here..
printf("head is %lu %d\n", head, head);
gives head is 4294967297 1
So, while head should be 1.. I am guessing, it is being passed to that garbage value .. How do i fix this ?