Search:

Type: Posts; User: Avanish Giri

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Actually I just realized that I had my comparison...

    Actually I just realized that I had my comparison operator backwards. It should be if ( array [ end_search / 2 ] > num ) ....

    But it still seg faults.. I do not get it. But I feel as though I...
  2. Andurii, thank you, that was exactly what I was...

    Andurii, thank you, that was exactly what I was looking for. To be honest, I tried running it in gdb, I did! I got to the point where I said backtrace, but it didn't show me the variables as it did...
  3. Sorry, I'm still confused. Does anyone see why...

    Sorry, I'm still confused. Does anyone see why this seg faults. Obviously something is wrong but it seems to me like it should work..
  4. Can anyone tell me what exactly is going wrong...

    Can anyone tell me what exactly is going wrong with my code, for pedagogical purposes?

    This isn't homework by the way, it is pure recreation.

    I do think I have the concept of binary search...
  5. Will this binary search implementation of mine work??

    Right now, its compiling and seg faulting..

    Can anyone tell me

    a) Why it is seg faulting

    b) Is this the right implementation

    c) What is a more elegant way to do this
  6. Replies
    1
    Views
    954

    strtok magic

    I have a question about strtok(char*, const char*)

    I know it is supposed to be used the way its used in the following example, but I don't understand why you send it NULL within the while loop...
  7. Replies
    8
    Views
    2,994

    What do the backticks do then? I was under the...

    What do the backticks do then? I was under the impression that you placed them around every command in the script.
  8. Replies
    8
    Views
    2,994

    Yes. The compressed file is a C file :) . I...

    Yes. The compressed file is a C file :) . I also felt that someone on here would be more likely to help me out. Ooga booga, you are truly a saint! Thank you.
  9. Replies
    8
    Views
    2,994

    Simple shell script question.

    I have to write a shell script that uncompresses files based on their suffix. i.e if the file is tar I would use tar -x

    .. Simple enough.

    So here is my script:


    #!/bin/sh
    case $1...
  10. LOL!! That was it... but I'm crying on the...

    LOL!! That was it... but I'm crying on the inside. God how did I miss that, thanks!
  11. Firstly, thank you so much for spending time...

    Firstly, thank you so much for spending time helping me.

    I added those == in a rush after reading your first reply, saying I was going out of bounds. I thought maybe I should initialize them to...
  12. How could that be it though. I probably should...

    How could that be it though. I probably should have mentioned this, but I initialized the array to 50 cells. I'm merely trying to access the 4th or 5th or 6th one.

    Just to be sure, I left the...
  13. Wait, what? What loop are you referring to? The...

    Wait, what? What loop are you referring to? The last loop before the comments works fine when the commented code is not included. Why would it stop working? Also, the whole point is to move each...
  14. In particular, why would the last printf...

    In particular, why would the last printf statement, which printed the results of my moved array just fine sans the code, now stop working, even if there was something wrong with the code after it.
  15. Help with this piece of code to multiply a string by two

    Below is a piece of code in a program I am making. This function takes in a char* and int argument, the char pointing to a string of numbers, and the int representing the length of the array.
    ...
  16. Can someone give me a very quick and simple explanation of how to make a makefile

    Since I am getting a lot of help here I thought I would try this question. I always avoid makefiles because the syntax is daunting. What are the benefits of makefiles?

    Every explanation I see is...
  17. Haha, ooga, I swear I didn't read that before I...

    Haha, ooga, I swear I didn't read that before I did it but thanks any way. You are a wise fellow
  18. NVM Fixed it. I simply moved the last_cell...

    NVM Fixed it. I simply moved the last_cell variable assignment up to before my loop converting the string ASCIIs into their decimal values. If anyone cares, haha
  19. Because I am trying to do this for arbitrarily...

    Because I am trying to do this for arbitrarily long integers between 1 and 255. So that was my first plan of action, but at around 24 ints or so the long long int stops holding the conversion value...
  20. I think the problem is that when I run the strlen...

    I think the problem is that when I run the strlen function, it picks up the 0s as a "/0" null terminating character and thus errs in its measurement of the string. How else can I do this. I tried...
  21. Can someone help me with this small piece of code

    Okay, so I have this piece of code here to input a string from user and convert it to a string half of the size. It works for all inputs except for ones with Zeroes in the middle. For example:
    ...
  22. Oh my god.. That's brilliant.... What is the...

    Oh my god.. That's brilliant....

    What is the intuition behind that?
  23. I don't get your method. Formerly I was taking...

    I don't get your method. Formerly I was taking the whole number, modding it by 2, and dividing it by 2. That worked on the whole integer.

    I don't see how this works going character by character...
  24. No a character limited to characters '0' - '9'. ...

    No a character limited to characters '0' - '9'. The problem isn't the conversion, it's the scale of conversion that needs to be done. Once I reach a certain order of magnitude, there is no...
  25. I'll check that out, but the prof said even...

    I'll check that out, but the prof said even Unions were not allowed so I doubt it. I thought I had the problem handled. I haven't explained the full assignment here, but basically my algorithm is...
Results 1 to 25 of 32
Page 1 of 2 1 2