Search:

Type: Posts; User: laserlight

Page 1 of 20 1 2 3 4

Search: Search took 0.16 seconds.

  1. Replies
    2
    Views
    93

    Are you aware that this is a forum for the C...

    Are you aware that this is a forum for the C programming language, whereas the code that you posted is not written in the C programming language?
  2. Replies
    9
    Views
    117

    The second argument to creat is the mode, not...

    The second argument to creat is the mode, not file creation flags.
  3. Replies
    2
    Views
    79

    You could store generic regions of memory instead...

    You could store generic regions of memory instead (i.e., objects, except for the lack of type information beyond the size), by recording the size of one object of the given type. This way, you still...
  4. Replies
    4
    Views
    87

    Of course. Whose code is it? Probably...

    Of course. Whose code is it?


    Probably because it must outlive the scope of the function. I'm not familiar with this API, but in modern C++ we are unlikely to do things this way: we would be...
  5. Replies
    4
    Views
    87

    I would expect it to be used when dynamic memory...

    I would expect it to be used when dynamic memory is required or at least convenient, or when stack memory is expected to be insufficient. So examine the code and see whether these apply.

    By the...
  6. Replies
    30
    Views
    339

    You might want to consider parsing...

    You might want to consider parsing /proc/<PID>/stat instead as it is supposed to be more machine-readable (with say, scanf or sscanf) whereas /proc/<PID>/status is supposed to be more human-readable....
  7. It might be helpful to avoid global variables:...

    It might be helpful to avoid global variables: only declare variables within functions. Then you find out how you can provide addnumbers with two int parameters such that the main function can call...
  8. The warning is because you didn't declare the...

    The warning is because you didn't declare the function addnumbers before calling it in the main function. What you need to do is to either forward declare the function (i.e., declare it before main...
  9. Replies
    3
    Views
    140

    It seems to me that the man page you consulted...

    It seems to me that the man page you consulted has answered your question.


    Which other sources are these?

    EDIT:
    My bad. Something sounded wrong to me, and I decided to check my own system's...
  10. Replies
    8
    Views
    231

    The problem is that you're using the %c format...

    The problem is that you're using the %c format specifier to print a non-printable character in this context. Try: c=0x4B or c=0x7A


    So you know that it is correct. You don't have to worry about...
  11. Replies
    7
    Views
    135

    It is legal (as you can see from your test with a...

    It is legal (as you can see from your test with a compiler), but that means in your post #3 you correctly worked out the ramifications of the conversion of string constant to pointer (to char) on...
  12. Replies
    7
    Views
    135

    I meant exactly that: compare...

    I meant exactly that: compare serie_list[i]->serieName with "" instead of "\0", because the intent is likely to check if serie_list[i]->serieName is an empty string, whereas "\0" is not semantically...
  13. Replies
    7
    Views
    135

    Yes, but it means either using strcmp or directly...

    Yes, but it means either using strcmp or directly comparing for the empty string by testing if the first character is '\0'.
  14. That's good, but you should also indent your code...

    That's good, but you should also indent your code properly. This way, it becomes easier to trace through what's happening in your code, which is precisely what you need to do in order to figure out...
  15. That's feedback with very low value. It is only...

    That's feedback with very low value. It is only useful if there was an obvious error in that example, if not, as stahta01 implied, it probably means that you made a mistake, but no one else knows...
  16. Post your code in forum bbcode tags, not quote...

    Post your code in
    forum bbcode tags, not quote tags.
  17. Replies
    7
    Views
    135

    What's the problem, i.e., how does it not work? ...

    What's the problem, i.e., how does it not work?


    For the special case of zero, it might be more convenient to use calloc instead of malloc then.

    By the way, this likely to be a bug:

    for (i...
  18. You forgot the closing double quote for the...

    You forgot the closing double quote for the string constant on this line:

    printf("The youngest, %s, is %d.\n, childname, age);
  19. Replies
    8
    Views
    231

    It seems to me that '0xAA' is a multi-character...

    It seems to me that '0xAA' is a multi-character constant formed from the characters '0', 'x', 'A', and 'A', whereas '\xAA' is a character constant having a value of 0xAA.
  20. The function is declared in fe-auth.h, so I don't...

    The function is declared in fe-auth.h, so I don't see what's the problem: just include that header and link appropriately.
  21. Replies
    5
    Views
    191

    No, you don't. addNode returns a pointer to head,...

    No, you don't. addNode returns a pointer to head, so you just need to use it:

    list = addNode(list, 1);
  22. A string is already an array: an array of...

    A string is already an array: an array of characters whose elements in use are at index 0 up to the index of the first null character.
  23. Replies
    5
    Views
    191

    The programming language that that code was...

    The programming language that that code was written in was unstated. It certainly looks like C, and with the right declarations it will probably be compilable as C, but I suggest treating it as...
  24. The problem is that in increase_nodes_capacity,...

    The problem is that in increase_nodes_capacity, nodes is a pointer to Node. It should be a pointer to a pointer to Node so that you can change it from within the function.
  25. Replies
    5
    Views
    253

    As in you cannot change your function signature...

    As in you cannot change your function signature and return type? If so, then indeed you must malloc to allocate space for the pointers, but as I said you need to allocate 1000 * sizeof(*sreees). You...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4