I have written a workable divisor algorithm that does this:
In order to get all divisors of a some number called "Num":
You search in the the range (1, num/2 + 1) and then do a for loop:
...
Type: Posts; User: tytelizgal
I have written a workable divisor algorithm that does this:
In order to get all divisors of a some number called "Num":
You search in the the range (1, num/2 + 1) and then do a for loop:
...
The purpose of this program I am writing is to take a page source of a news article website, parse the words and load them into a vector and a hashset. By the end you should be able to query (for...
i tried doing the malloc and allocating memory on the heap but that didnt work
i think the issue is instantiating the struct
basically what i have is a pointer to a struct called wordstruct...
i am trying to declare a vector new on a pointer ....i am seg faulting at the vector new and i have no clue why: (the goal of this program is to go through a website adn parse words and populate a...
I'm using X11 with Mac and would like the scroll up in the terminal. IS there any command for doing this?
here is the code for vfree (it is being called on to pointers to strings (char*'s, dynamically allocated):
/**
* Function: FreeString
* --------------------
* Understands how to...
I am trying to write a vector dispose function that frees the individual elements addressed in my vector. Basically v-> elems points to the first element in an an array of elements, each of which is...
I was ssh'ing into a UNIX pod (at stanford university) through my lap top in X11. Everything was going great. Then I had to close my computer and reopen X11. This time, it said my memory storage...
But I have to free an element that is not at the beginning of the vector...so how would I do that using v->elems?
Here is my allocation code from vector new:
Yes, I was a little iffy on moving around the v-> elems pointer as I thought it should always point to the beginning of my array.
void...
I am still getting the same issue...I took the suggestion into account that I should be freeing the exact pointer that I malloc'd...
//VectorDelete will use the client-supplied free function...
Hmm taht was given in the test code (I didn't write that) I think 3 is still valid because when you go through and delete, the indices all drop by 1 so the next one (the one that used to be 4 away)...
I am implementing a vector in C and am having trouble with the delete function.
1) here is my vector struct:
typedef struct {
void* elems;
int elemSize;
int logLength;
int...
oh i think i figured it out ...you cast everything to char* because what i am doing is counting bytes :)
In the code it's lines such as this:
v is a vector struct that has {
void* elems;
int elemsize;
int alloclength;
int loclength;
}
The void* lines are stuff like this:
Is there any way to get rid of warnings that say "pointer of type void * used in arithmetic?' my program still runs fine....i just want to know if there is a way to tell the terminal i['m using that...
great, thanks so much! :)
When I research memmove online I get tons of websites telling me the difference between memmove and memcopy. I know that memmove does the checks for overlapping memory that memcpy doesn't. I also...
Hello,
Here is my problem:
I declare the vector struct in my .h file and then try to access its fields in the .c file. I did declare a variable of type vector. However, I get a compiler error...