Search:

Type: Posts; User: laserlight

Page 1 of 20 1 2 3 4

Search: Search took 0.32 seconds.

  1. Replies
    2
    Views
    105

    What is the test that fails? If you were not...

    What is the test that fails?

    If you were not given the test values, then you should write your own 9 tests that try to replicate what your instructor is testing. Knowing what is the failing test...
  2. Replies
    1
    Views
    237

    Sounds good. What's your plan, what have you done...

    Sounds good. What's your plan, what have you done thus far, and what help do you need?
  3. Thread: Macro help

    by laserlight
    Replies
    3
    Views
    330

    I can't say I've ever had reason to use the...

    I can't say I've ever had reason to use the feature myself, but variadic macros were introduced in C99.
  4. Replies
    15
    Views
    746

    No, it isn't, not at all. I demonstrated bundling...

    No, it isn't, not at all. I demonstrated bundling the head and tail in a single structure as an abstraction of a singly linked list that also keeps track of its tail, since Djsarkar was originally...
  5. Replies
    7
    Views
    961

    But how? The code that you provided does not have...

    But how? The code that you provided does not have any static data members (or any data members at all) so "static member data can be shared across all instances" is obviously not a reason. There are...
  6. Replies
    7
    Views
    961

    Err... the fact that you're listing four options...

    Err... the fact that you're listing four options that are rather different is rather weird. It is almost as if this is some MCQ question for a homework assignment and you're hoping someone will just...
  7. Replies
    7
    Views
    961

    The static keyword here just designates the...

    The static keyword here just designates the member function as a static member function. You could just as easily use a non-member function, except that it makes sense to associate the function more...
  8. Replies
    2
    Views
    306

    If you're dealing with a linked list that has...

    If you're dealing with a linked list that has both head and tail, then I would suggest something like this:

    struct Node
    {
    int Value;
    struct Node *Next;
    };

    struct LinkedList
    {
  9. The simple answer is: no, because it is invalid...

    The simple answer is: no, because it is invalid syntax.

    There may be some edge case or whatever where this is not true, but I don't feel like researching it, especially not when it'll probably...
  10. You've been told to make use of learning material...

    You've been told to make use of learning material like introductory books that would explain these to you. Do that.

    If you want to do exploratory learning, well, that's not necessarily wrong, but...
  11. The output is obviously different. Ok, maybe not...

    The output is obviously different. Ok, maybe not that obvious, but that's because you printed so many lines when just a few critical ones would have done the job.
  12. Replies
    15
    Views
    571

    Yeah, but isn't this futile? Everyone has their...

    Yeah, but isn't this futile? Everyone has their own preferences, e.g., I feel three spaces before a trailing comment is unnecessary, but frankly, it looks alright.

    When I think of flaws, I think...
  13. Replies
    15
    Views
    571

    Yeah, refer to my edit: I realised that I misread...

    Yeah, refer to my edit: I realised that I misread the post because I was led astray by the question and sample solutions given in the linked page instead of reading your explanation carefully. No...
  14. Replies
    15
    Views
    571

    EDIT: Oh wait, I think I understand now. ...

    EDIT:
    Oh wait, I think I understand now.

    You're not talking about programming in C to improve some sample solutions that you encountered. You're talking about whether calling this command:
    ...
  15. Replies
    15
    Views
    571

    "Indent" usually means something like "place the...

    "Indent" usually means something like "place the text at some offset relative to the current margin", hence the common notion of indenting code by a certain number of spaces. What you're doing here,...
  16. Replies
    3
    Views
    685

    I only joined a bit later hah

    I only joined a bit later hah
  17. Replies
    4
    Views
    581

    Where did you find this example? By now you...

    Where did you find this example? By now you should know enough to figure out from context.

    Besides figuring out from context, there's another thing you can do: write a program to test your...
  18. Replies
    4
    Views
    581

    It's the same as your last example, except that...

    It's the same as your last example, except that the return type is pointer to int.
  19. The problem is that when you read the double with...

    The problem is that when you read the double with the previous scanf call, the newline from entering the line of input remains in the input buffer, and this is then read by the scanf call with "%c"....
  20. Can't really call it a bug when the compiler...

    Can't really call it a bug when the compiler still works perfectly fine and remains standard conforming. An odd way of dealing (or just not dealing) with UB, perhaps?
  21. Replies
    20
    Views
    969

    hamster_nz was replying to Nwb, as you can see...

    hamster_nz was replying to Nwb, as you can see from the quote. You should read hamster_nz's post #12 instead.
  22. Replies
    3
    Views
    333

    That doesn't mean anything. The expression is:...

    That doesn't mean anything. The expression is: memcmp(data_in, data_out, sizeof(data_in)) == 0

    That is, it is checking that the memory represented by data_in and data_out contain equal values.

    ...
  23. Replies
    20
    Views
    969

    Salem already provided the example of reading a...

    Salem already provided the example of reading a file.

    You're right to say that if you want to store 10 integers then the size will be 10. Dynamic memory allocation comes into play when you want...
  24. Replies
    20
    Views
    975

    That's not true. It's just rarely used since it...

    That's not true. It's just rarely used since it is the default. Here's a valid example from the C standard:

    extern int max(int a, int b)
    {
    return a > b ? a : b;
    }


    You didn't actually...
  25. Replies
    6
    Views
    364

    That's an interesting claim, so I wrote this...

    That's an interesting claim, so I wrote this program to check:

    #include <stdio.h>

    #define STR1 "CORRECT"
    #define STR2 "WRONG"

    int main(void)
    {
    char ch = 'A', ch2 = 'a';
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4