Search:

Type: Posts; User: john.c

Page 1 of 20 1 2 3 4

Search: Search took 0.01 seconds; generated 51 minute(s) ago.

  1. Replies
    3
    Views
    75

    No, it doesn't compile. Zeus is confused between...

    No, it doesn't compile. Zeus is confused between C++ and C.
    Your code is correct, although using ++ is more usual.


    Passing a pointer to the first element is essentially passing the whole array...
  2. Please post actual code that you've ran then...

    Please post actual code that you've ran then copy/pasted, not something you just typed up. :tongue:

    What is inbuf? What is newline? (Presumably inbuffer and n.)
    And you have a semicolon in one...
  3. Replies
    6
    Views
    150

    Look at all three posts by this weirdo, this post...

    Look at all three posts by this weirdo, this post and the following two, all posted at about the same time.
    They are all meaningless garbage and remind me of the kind of useless add-on comments that...
  4. Replies
    15
    Views
    261

    Sure, post the GitHub link and the other stuff. ...

    Sure, post the GitHub link and the other stuff.

    @rstanley, Large multi-file programs are probably best posted as a link.
  5. It struck me as an old-fashioned style. Maybe...

    It struck me as an old-fashioned style. Maybe you're using an old book. Or have an old teacher. Whatever. :p
  6. It's the arbitrary actions of UB stemming from...

    It's the arbitrary actions of UB stemming from the uninitialized "top" pointer in "rev". It needs to be initialized to NULL.
  7. Replies
    8
    Views
    211

    You've been given more than enough information in...

    You've been given more than enough information in your thread on the other site: how read the GIF and JPG image size? - C++ Forum

    And from the code you've shown you clearly don't know what you...
  8. It's pretty obvious you didn't write that code.

    It's pretty obvious you didn't write that code.
  9. Replies
    2
    Views
    110

    It says that unsigned integers are supposed to...

    It says that unsigned integers are supposed to function the same across all implementations. It doesn't say anything about "testing for overflow of unsigned integers". In fact, you might say that...
  10. No. If curr could just be a single-level pointer...

    No. If curr could just be a single-level pointer I would've wrote it that way since it would be simpler. The reason you need the second level of indirection is that we don't want curr to hold the...
  11. The recursive version is better written like...

    The recursive version is better written like this:


    ListNode *merge2(ListNode *a, ListNode *b )
    {
    if (!a) return b;
    if (!b) return a;

    if (a->data <= b->data)
    {
  12. typedef struct listnode { char data; ...

    typedef struct listnode {
    char data;
    struct listnode *next;
    } ListNode;




    ListNode *merge(ListNode *a, ListNode *b)
    {
  13. Replies
    3
    Views
    132

    The format specs that read ints and floats and...

    The format specs that read ints and floats and the format spec "%s" all skip initial whitespace so there's no difference in functionality.
    Maybe your version is more readable, though.
  14. Replies
    3
    Views
    132

    We usually handle this kind of thing by first...

    We usually handle this kind of thing by first reading the entire line as a string, and then using sscanf to "scan" the numbers from the string. All the scanf functions return a count of the number of...
  15. Replies
    9
    Views
    155

    The format spec for long long is "%lld". You have...

    The format spec for long long is "%lld". You have "%ld", which is for long.

    If long long is actually bigger than long on your machine and your machine is little endian, then a 0 output for a...
  16. Don't just say "and the second problem is that it...

    Don't just say "and the second problem is that it does not work". Of course it "works". Post your broken code that you actually ran so we can show you your error. :mad:
  17. Replies
    9
    Views
    250

    What does that mean? Do you want to know how...

    What does that mean?

    Do you want to know how to retrieve the hdd SN?

    Do you want to know how to "embed" the hdd SN in an exe?
    What does "embed" mean?
    Why do you want to do this?
    Maybe...
  18. You're just inventing how strcmp works. Where...

    You're just inventing how strcmp works.
    Where did you read it returns a count of matching characters?
    It's return value is 0 if ALL characters match.
    It returns a negative (but otherwise...
  19. Replies
    4
    Views
    150

    With Fortran's implicit typing, variables...

    With Fortran's implicit typing, variables i,j,k,l,m,n are integers; others are real.
    Variables do not need to be declared (will equal 0 on first use ... I assume).
    The loops include their ending...
  20. Replies
    4
    Views
    169

    You can allocate more memory than you have...

    You can allocate more memory than you have physical RAM. The memory that is allocated is "virtual memory" and can in fact exist mostly on disk. This can then be very slow to use, of course, but...
  21. Replies
    2
    Views
    182

    #include #include bool...

    #include <stdio.h>
    #include <stdbool.h>

    bool calc()
    {
    int a, b, c = 0;
    char o;
    printf("> ");
    if (scanf("%d %c %d", &a, &o, &b) != 3) return false;
    switch (o)
  22. The code you've shown can be rewritten as shown...

    The code you've shown can be rewritten as shown below.
    Instead of a bunch of numbered variables (code1, code2, etc.) use an array; but remember that array indices start at 0 and go to one-less-than...
  23. Here is a clean-up of your code. 'fin' only...

    Here is a clean-up of your code.

    'fin' only has space for one address (and it has a global doppleganger for some reason). So once count is incremented past 0 it will be an out-of-bounds access. I...
  24. Replies
    2
    Views
    183

    #include #include ...

    #include <stdio.h>
    #include <stdlib.h>

    typedef struct Node
    {
    int data;
    struct Node *next;
    } Node;

    Node *AddNode(int data, Node *prev)
  25. Replies
    4
    Views
    222

    #include #include //...

    #include <stdio.h>
    #include <stdlib.h>

    // Print array a of size n on a single line.
    void print(int* a, int n)
    {
    for (int i = 0; i < n; i++)
    printf("%d ", a[i]);
    ...
Results 1 to 25 of 496
Page 1 of 20 1 2 3 4