Search:

Type: Posts; User: Karthur

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    20
    Views
    2,960

    Actually, the area was probably initialized to...

    Actually, the area was probably initialized to nulls by the OS or the OS's loader. Then the stack was used by the c-program starter module which was linked into your (every) program by the compiler,...
  2. The reason you had trouble - and any compiler...

    The reason you had trouble - and any compiler would - is that you started the comment with /* so the compiler never knew you then started a string with " and didn't want the */ in your string...
  3. Replies
    6
    Views
    5,104

    But on the other hand, with simple algebra, your...

    But on the other hand, with simple algebra, your problem simplifies to rate * (1+rate), so why bother?
  4. Replies
    7
    Views
    1,650

    In this case, he wants to read strings, store...

    In this case, he wants to read strings, store them, and then print them in reversed order, or read the whole file into a buffer, change all the newlines to nul chars, then scan from the back of the...
  5. Replies
    12
    Views
    2,012

    That incrementing a void* pointer should properly...

    That incrementing a void* pointer should properly do nothing or anything since the length of a unit is undefined? How big is nothingness? How full - or empty - is the location pointed to by a...
  6. The above should be enough, but if this is really...

    The above should be enough, but if this is really bad and hard to find you can set up a queue to store malloced addresses, have "safemalloc" put address in the queue, have "safefree" remove it, and...
  7. Thread: test question

    by Karthur
    Replies
    3
    Views
    1,657

    Your change would reference a position outside...

    Your change would reference a position outside the array, so it's indeterminate, may even crash the program.

    No. You could use a pointer in moving the contents of an array, but the array would...
  8. Thread: ADT queue

    by Karthur
    Replies
    4
    Views
    10,868

    And in general, you should be aware that you are...

    And in general, you should be aware that you are queueing pointers, not things, so be sure the things continue to exist as long as they are pointed to by the address in the queue.

    Generally, if...
  9. Replies
    5
    Views
    1,393

    You haven't shown how List is defined, but...

    You haven't shown how List is defined, but apparently its something like:


    typedef struct {
    ...
    int count;
    char[99] list; /* or some other arbitrary length */
    ...
    }...
  10. Replies
    16
    Views
    73,008

    The struct definition contains one position -...

    The struct definition contains one position - that accounts for the nul later. And only one free is required because it is all one continguous unit. It acts as a variable length struct.

    Just...
  11. Replies
    3
    Views
    3,703

    How about: temp_totalprice1 =...

    How about:


    temp_totalprice1 = temp_totalprice1 * temp_quantitysold1;

    and of course it doesn't assign the int price to temp_totalprice - you have it assigning to temp_totalprice1
  12. Replies
    16
    Views
    73,008

    But the whole thing can be done by: typedef...

    But the whole thing can be done by:


    typedef struct {
    char msg[1];
    }

    int main ( int argc, char **argv )
    {
    mystruct* a;
  13. Replies
    5
    Views
    1,393

    You must have copied it wrong, or its bad code. ...

    You must have copied it wrong, or its bad code. There is an unmatched "]" in there.
    Without that it would compare 2 addresses (usually a meaningless action unless in the same array). Try again.
  14. Replies
    4
    Views
    3,338

    And to simulate "expect", you will need at least...

    And to simulate "expect", you will need at least two threads, a reader and a writer, maybe more. This is a bit of a rough project for a first shot at C.
  15. Replies
    1
    Views
    15,201

    So what does and/or doesn't happen? How are you...

    So what does and/or doesn't happen? How are you trying to run them?
  16. Replies
    21
    Views
    3,897

    To start over, you can't allocate space usefully...

    To start over, you can't allocate space usefully until you know how much spoace you want to allocate. This means that you can't just allocate at compile time unless you at least know a safe maximum....
  17. Replies
    4
    Views
    1,460

    /bin is a common place to store programs -...

    /bin is a common place to store programs - usually without a .bin extension. If it has a .bin extension it's probably just binary data tagged to tell you not to treat it as text. Any file can...
  18. Thread: sorting words

    by Karthur
    Replies
    5
    Views
    2,251

    Sorry. Mistake. Put the Jr,Sr,III,Esq,etc after...

    Sorry. Mistake. Put the Jr,Sr,III,Esq,etc after the middle initial or name as part of that unit.

    Minor field is sorted first, then the major using a sort method that maintains order - or convert...
  19. Thread: sorting words

    by Karthur
    Replies
    5
    Views
    2,251

    Names are normally sorted by sorting the last...

    Names are normally sorted by sorting the last name (w/ Jr, Sr, III, etc) major, left justifed, and any other (first, middle or initial) asa secord unit, left justified minor.

    Alpha is always...
  20. A couple things to get started (from a quick...

    A couple things to get started (from a quick read-thru). You close by a function and directly - pick one method and stick to it. "SearchBySupplier doesn't close the file unless it succeeds - but...
  21. Replies
    8
    Views
    2,046

    One problem: The file is opened twice against...

    One problem: The file is opened twice against the same File ptr if it already exists.
    The test only ran against "no existing file".

    To correct: move the second readmode open inside the (!file)...
  22. Thread: Pass

    by Karthur
    Replies
    8
    Views
    1,166

    Your real problem is that you are trying to use...

    Your real problem is that you are trying to use data in statbuf (which you have declared)
    to select out directories without ever filling the buffer with any data (use fstat)!
  23. Replies
    6
    Views
    7,435

    After the (an arbitrary) program runs for a...

    After the (an arbitrary) program runs for a while, there will be many chunks allocated and given back and they will be in abitrary order as far as their next assignment is concerned. Then you cannot...
  24. Replies
    5
    Views
    6,052

    Dead eternity's code looks good, it just isn't...

    Dead eternity's code looks good, it just isn't part of your program yet. You need to be sure all the variables are named the way you want them and have all been declared. Yes, of course, it's...
  25. Replies
    6
    Views
    50,519

    Also, you tried to use minfee before you assigned...

    Also, you tried to use minfee before you assigned it a value (never did), and didn't use it when you needed the minimum only (hard coded 2.00 instead), and finally you forgot that 2.00 + (21 * 0.50)...
Results 1 to 25 of 38
Page 1 of 2 1 2