Search:

Type: Posts; User: AAnderson

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    5
    Views
    2,611

    scanf leaves "\n" (the enter key or newline...

    scanf leaves "\n" (the enter key or newline character), in the buffer after it reads it. Your next call to read the buffer, i.e. via gets, sees a newline chara and returns straight away. You need to...
  2. Replies
    10
    Views
    1,117

    Yeah, I'm confused as well, if you want to print...

    Yeah, I'm confused as well, if you want to print the bytes themselves then you'll have to loop through your buffer (or the file) and print those elements.
  3. Replies
    14
    Views
    4,336

    Hmm, as a noobish question, is the benefit of...

    Hmm, as a noobish question, is the benefit of maintaining a separate structure for first and last items faster look up times? I looked over this link: C Linked List Data Structure Explained with an...
  4. Replies
    14
    Views
    4,336

    I'm following along this topic with interest....

    I'm following along this topic with interest. Would the answer to this particular walking be recursive call?
  5. The first time through, your program is going to...

    The first time through, your program is going to try access source outside its bounds. j is initialised to 0, you call j-1 which will be before the start of your source string, you have no guarantees...
  6. Replies
    2
    Views
    4,421

    Hmm, just wondering why you strcpy your string...

    Hmm, just wondering why you strcpy your string into an address 1 ahead of the one you just allocated?
  7. Replies
    14
    Views
    1,745

    Yeah, you don't just "get" programming, much like...

    Yeah, you don't just "get" programming, much like you don't just "get" spanish or any other language. You have to be playing around in your own time, making things, breaking things, etc. Much like...
  8. Replies
    5
    Views
    1,233

    Why do you have the big if statement checking...

    Why do you have the big if statement checking bossDirection and assigning newDirection if newDirection always = bossDirection?

    Also, why use pragma omp (not that I really have any idea what that...
  9. Replies
    16
    Views
    1,712

    You've already identified your problem, so how do...

    You've already identified your problem, so how do you stop your loop iterating over the edge of your array? Also, write out what you think your algorithm will do for a very short array (say 5 long),...
  10. Replies
    16
    Views
    1,712

    What happens if instead you tell temp to grab...

    What happens if instead you tell temp to grab a[i+1], or a[i+10] etc?
  11. It looks like you're printing your array of...

    It looks like you're printing your array of character elements as if they were integers. I'm surprised you're not segfaulting. You should use %c as your format element if you want to print characters.
  12. Replies
    16
    Views
    1,712

    You shouldn't need a second loop for that. Think...

    You shouldn't need a second loop for that. Think about how you can do it by manipulating your index (your i) to access different elements during each loop iteration. Just use your temp to hold one of...
  13. Replies
    16
    Views
    1,712

    Hi Phil, It really depends how you want to...

    Hi Phil,

    It really depends how you want to swap the values, do you want to permute them randomly? Do you want swap every second value?

    On a tangent, you should iterate from i = 0 to i < size. I...
  14. Thanks for the info guys.

    Thanks for the info guys.
  15. Sorry I can't answer your question off the top of...

    Sorry I can't answer your question off the top of my head, but in my admittedly very short experience with C, I haven't seen the practice of declaring your function inputs outside the curly bracers,...
  16. Replies
    4
    Views
    767

    What laserlight said, also, if you really want to...

    What laserlight said, also, if you really want to use a number. You could just check if(aussie), then any number except 0 will give you a true result.
  17. Replies
    3
    Views
    861

    Hey mate, I'm an absolute baby at C but there's...

    Hey mate, I'm an absolute baby at C but there's one thing I noticed.

    In the insert_at_end function:

    You declare *st but you don't initialise it before passing it to the strlen function. You...
  18. Replies
    58
    Views
    5,932

    Taking my thoughts on this a little further, I...

    Taking my thoughts on this a little further, I don't know why I didn't see that I could just store the information as text strings and then parse them for the ID information as I reload them.
    ...
  19. Replies
    58
    Views
    5,932

    Nope, purely unfamiliarity with best practices. I...

    Nope, purely unfamiliarity with best practices. I just took a stab using the initial program as a base (which did have statically allocated arrays). The problem is simplified if I remove the...
  20. Replies
    58
    Views
    5,932

    Ahhhhhhhhhhh, light bulb! I had wondered about...

    Ahhhhhhhhhhh, light bulb!

    I had wondered about that, do you have any suggestions for how I should approach the problem then? Re-link the pointers after reading in raw data? Avoid writing the...
  21. Replies
    58
    Views
    5,932

    What you say makes sense, but fwrite doesn't...

    What you say makes sense, but fwrite doesn't actually write the pointer out. From the linux man pages:



    As I understand it, those function are writing a block of memory of a certain size to...
  22. Replies
    58
    Views
    5,932

    Can you elaborate on what you mean? If you've...

    Can you elaborate on what you mean? If you've followed this thread (I don't expect you to have, it's long and there's a lot of tangential debate). You'll know that this task I've set myself is a...
  23. Replies
    58
    Views
    5,932

    Ahhhhh, I think I've cracked it. I was using...

    Ahhhhh, I think I've cracked it. I was using sizeof(char*) instead of sizeof(char). Using sizeof(char) returns no errors except for that very last one about unintialised bytes, which I think is...
  24. Replies
    58
    Views
    5,932

    Good point, I made the modification but it hasn't...

    Good point, I made the modification but it hasn't fixed the problem. The output is exactly as before. Same error, same mem location.
  25. Replies
    58
    Views
    5,932

    Hi Jim, The first line of the output is...

    Hi Jim,

    The first line of the output is actually how the program was launched, i.e. "... ./ex17 alloctest4 c". There is no input file as such, it is created by Database_open (or opened if the flag...
Results 1 to 25 of 31
Page 1 of 2 1 2