Search:

Type: Posts; User: dan_paul

Page 1 of 2 1 2

Search: Search took 0.00 seconds.

  1. Replies
    6
    Views
    1,425

    I'm a beginner myself so not sure how much help...

    I'm a beginner myself so not sure how much help this is but thought your code might be easier if you separate the swap function into a separate function. I haven't tested this but hopefully it...
  2. Replies
    4
    Views
    1,680

    Thanks Adak. That will eventually come up I'm...

    Thanks Adak. That will eventually come up I'm sure but for my purposes, the dimensions of the array aren't necessarily "spatial" (if that makes sense). But I was thinking about it and came up with...
  3. Replies
    4
    Views
    1,680

    Oh, thanks. I understand, that makes sense. I...

    Oh, thanks. I understand, that makes sense. I had forgotten to include the ampersand. I had tried several permutations then after seeing your code I looked back and realized my printf statement...
  4. Replies
    4
    Views
    1,680

    pointer to an element of array as array?

    Is this possible? For my program, I have a lot of data that I want to store as one long array. This array will actually be a lot of smaller arrays "strung together". What I'd like to be able to do...
  5. Oh man, all these people giving me free help,...

    Oh man, all these people giving me free help, don't have the common decency to debug, compile and offer me a finished executable. The nerve! :)
  6. Huh? No way dude. I'm doing this because I love...

    Huh? No way dude. I'm doing this because I love to. I was just stuck and needed some help on one piece of a larger project. The only thing I really used was the line which I corrected and...
  7. Thanks so much for your advice. I really...

    Thanks so much for your advice. I really appreciate well formatted code so thanks for the comments about how to properly format. For some reason, when I stopped writing C++ I started declaring my...
  8. confusion regarding 2D array of struct pointers

    I'm trying to construct a little simulation in which I have a 2D World populated by Agents. I'm trying to construct this world as a 2D array of pointers to Agent structs. If no agent is present on...
  9. Replies
    3
    Views
    14,190

    Hi, I'm not sure I understand exactly what you...

    Hi,

    I'm not sure I understand exactly what you mean regarding "mapping" but I think an enum type might be useful for you. If you're trying to produce a unique numeric value for each card, you...
  10. Announcements - General Programming Boards ...

    Announcements - General Programming Boards

    Announcements - C Programming
  11. I thought the following might help from the...

    I thought the following might help from the string.h library. C string functions
    You would have to write a function to "slice" the non-numeric chars out of your string but you could use strpbrk to...
  12. Well... what have you tried so far? You could...

    Well... what have you tried so far?

    You could use for loops to iterate the elements of the array. A for loop will work to check it against the elements of your unique[] array. Try to figure it...
  13. Lol, good programmers are nothing if not precise!

    Lol, good programmers are nothing if not precise!
  14. That's a good idea. I hadn't considered it. For...

    That's a good idea. I hadn't considered it. For my purposes, the easier but imperfect solution will work but if not excluding any numbers was really important, it seems like your solution would be...
  15. Replies
    1
    Views
    855

    I think there's a few design changes that would...

    I think there's a few design changes that would make your program simpler and cleaner but to answer your question, you could put all the variables inside a data structure like a struct and then pass...
  16. Thanks for the reference and sorry I wasn't...

    Thanks for the reference and sorry I wasn't understanding exactly what you were asking about the value of RAND_MAX and INT_MAX.

    By the way, if anyone else is reading this for a solution to...
  17. Ah ha, just looked in the reference. I couldn't...

    Ah ha, just looked in the reference. I couldn't find an explicit definition of RAND_MAX but when I simply print the value on my machine, I get: 32767 (much lower than INT_MAX). The solution is...
  18. Good point, I should have thought of that. ...

    Good point, I should have thought of that.



    My understanding is that it is system dependent. Whatever the maximum value of int is on the machine running the code. For me it's: 2147483637
  19. My understanding is that you need the +1 to make...

    My understanding is that you need the +1 to make rand return a value inclusive of your max value. In any case, even if I don't +1 max_value, I still get results that appear too low and non-random.
  20. generating random numbers between 0 and INT_MAX

    I'm convinced I must be doing something fairly obviously wrong. I'm able to use the rand function to generate random numbers until I try to generate numbers inclusive of the max int value. If I use...
  21. Thread: long long?

    by dan_paul
    Replies
    7
    Views
    1,514

    Here is an article about numeric types in C that...

    Here is an article about numeric types in C that might help you:

    http://www.exforsys.com/tutorials/c-language/c-programming-language-data-types.html

    You may want to try an unsigned long long...
  22. Bloody brilliant! You debugged a function you...

    Bloody brilliant! You debugged a function you weren't even shown. You were right, the bug was in the insertion. In the case where the node was inserted at the end of the list, I pointed the...
  23. Thanks for your reply. I understand what you're...

    Thanks for your reply. I understand what you're saying. I believe I've already "trouble shot" the other potential pitfalls you mentioned and believe I've isolated the error to the line where I try...
  24. Replies
    6
    Views
    20,764

    I think the time.h library will be a good place...

    I think the time.h library will be a good place to start. here is a basic example:

    http://cboard.cprogramming.com/faq-board/9423-faq-how-do-i-display-current-time-date.html
  25. Replies
    3
    Views
    2,737

    I think more information would definitely be...

    I think more information would definitely be helpful. What are the parameters? Is the seating constant? Can the customer's request specific seats? Should groups be seated together? Should people...
Results 1 to 25 of 26
Page 1 of 2 1 2