Search:

Type: Posts; User: tytelizgal

Search: Search took 0.01 seconds.

  1. Replies
    6
    Views
    10,103

    Divisor Algorithm

    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:
    ...
  2. Replies
    1
    Views
    6,047

    Seg Fault in Compare Function

    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...
  3. Replies
    2
    Views
    6,670

    i tried doing the malloc and allocating memory on...

    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...
  4. Replies
    2
    Views
    6,670

    seg fault at vectornew

    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...
  5. Replies
    1
    Views
    1,574

    X11 scroll up

    I'm using X11 with Mac and would like the scroll up in the terminal. IS there any command for doing this?
  6. Replies
    3
    Views
    1,581

    here is the code for vfree (it is being called on...

    here is the code for vfree (it is being called on to pointers to strings (char*'s, dynamically allocated):





    /**
    * Function: FreeString
    * --------------------
    * Understands how to...
  7. Replies
    3
    Views
    1,581

    seg fault in vector delete function

    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...
  8. Replies
    1
    Views
    2,970

    difficulties with UNIX

    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...
  9. But I have to free an element that is not at the...

    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?
  10. Here is my allocation code from vector new: ...

    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...
  11. I am still getting the same issue...I took the...

    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...
  12. Hmm taht was given in the test code (I didn't...

    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)...
  13. Issues with pointer and freeing its associated memory

    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...
  14. Replies
    12
    Views
    5,787

    oh i think i figured it out ...you cast...

    oh i think i figured it out ...you cast everything to char* because what i am doing is counting bytes :)
  15. Replies
    12
    Views
    5,787

    In the code it's lines such as this: v is a...

    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:
  16. Replies
    12
    Views
    5,787

    void* warnings

    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...
  17. Replies
    9
    Views
    9,499

    great, thanks so much! :)

    great, thanks so much! :)
  18. Replies
    9
    Views
    9,499

    What does memmove actually do?

    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...
  19. Replies
    2
    Views
    3,281

    typedef struct from .h and .c

    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...
Results 1 to 19 of 20