Search:

Type: Posts; User: aghast

Page 1 of 3 1 2 3

Search: Search took 0.01 seconds.

  1. Replies
    5
    Views
    292

    The double pointer is one solution to programmer...

    The double pointer is one solution to programmer laziness. Here's the problem:



    struct Node {
    struct Node * next;
    ...
    };

    struct Node * Head;
  2. If you're transpiling to C, the output will be C...

    If you're transpiling to C, the output will be C code, no matter how complicated or awkwardly-written.

    However, as I pointed out, there are languages with features that you just cannot effectively...
  3. Thread: Beginner

    by aghast
    Replies
    5
    Views
    376

    Microsoft has problems with "staying inside the...

    Microsoft has problems with "staying inside the lines" when it comes to C. If you want to learn C++, MSVC is a great tool. If you want to learn C, I'd suggest you avoid MSVC until you have learned...
  4. It is not always possible to write a transpiler...

    It is not always possible to write a transpiler for a programming language. For example, dynamic languages such as Python or Lisp generally operate on a machine model that is not compatible with the...
  5. Replies
    3
    Views
    156

    What you are trying to build is a Singly Linked...

    What you are trying to build is a Singly Linked list. If you're asking this question, I strongly encourage you to read the Wikipedia article.

    Singly linked lists are not "the most important data...
  6. Replies
    10
    Views
    466

    Two things: john.c has shown you a great...

    Two things:



    john.c has shown you a great technique for simplifying almost all of your C code. If you are coding on Linux, you can make use of a library called libexplain. The same library...
  7. Replies
    3
    Views
    288

    Are you taking input from the user? Then the...

    Are you taking input from the user? Then the number is a string when you read it, and you have to somehow convert it to an int or float during the input process.

    Are you computing the number, or...
  8. Replies
    12
    Views
    603

    Like a lot of things, it's mainly from habit. ;-)...

    Like a lot of things, it's mainly from habit. ;-)

    I don't use variables (such as const uint8_t num_flexiforce_sensors = 8;) because they are variables, not constants. You cannot use a variable to...
  9. Replies
    3
    Views
    224

    Got any output?

    Got any output?
  10. Replies
    12
    Views
    603

    In function: saadc_sample(struct s_sampling...

    In function: saadc_sample(struct s_sampling *sampling)

    sampling->packet_counter;

    Remove this line, or change the code to support its use. It appears to do nothing, and I do not see any use of...
  11. Replies
    2
    Views
    294

    Break it down in small pieces. ...

    Break it down in small pieces.

    draw_rectangle(x, y)
    - draw ul corner
    - draw top line
    - draw ur corner
    - for loop
    - draw left side
    - draw right side
    - draw bl corner
  12. I don't fully understand your complaint, because...

    I don't fully understand your complaint, because your "error" example looks fine to me -- what should it be doing?

    Regardless, I think you are seeing the behavior that you are, because of the...
  13. Replies
    5
    Views
    424

    Remember that pointers in C have type...

    Remember that pointers in C have type information, but have no limits.

    That is, if I give you a pointer value, such as p = 0x12345678, and say "this is a pointer to struct Foo," you can access a...
  14. Replies
    4
    Views
    519

    I don't see any logic to ensure that the numbers...

    I don't see any logic to ensure that the numbers are in proper order. That is, you never check if a < b, or c < d, prior to doing your other checks. This would be validation and your course may not...
  15. Replies
    6
    Views
    476

    You say that one item is in the wrong place. Is...

    You say that one item is in the wrong place. Is that known? In other words, are you trying to solve a problem that guarantees that exactly one item is in the wrong place? Because that is different...
  16. Replies
    7
    Views
    732

    According to the standard, void * pointers are...

    According to the standard, void * pointers are "wide" enough (that is, they are made up of enough bits) to store any kind of pointer used by the system.

    There are, or have been in the past,...
  17. Replies
    25
    Views
    1,689

    Your print statement is commented out.

    Your print statement is commented out.
  18. Here's a hint: The problem statement...

    Here's a hint:

    The problem statement explicitly calls for column displays. And it appears to require the columns to correspond directly to the numbers entered. So you cannot reorder the numbers...
  19. Replies
    3
    Views
    613

    Create an array of const char * pointers into a...

    Create an array of const char * pointers into a single string. Each pointer must be distinct, but the set of pointers must also be compact.

    Use the _Generic() feature, with a macro, to implement...
  20. Thread: Macro help

    by aghast
    Replies
    3
    Views
    467

    You are passing everything through a call to a...

    You are passing everything through a call to a function. You can make that function into a varargs function by declaring parameters with '...', and then call vfprintf instead of fprintf, passing the...
  21. Replies
    25
    Views
    1,689

    The only errors I saw on your original code were...

    The only errors I saw on your original code were these:



    $ gcc -Wall -Wextra xx.c
    xx.c: In function ‘itoa’:
    xx.c:5:7: error: assignment of read-only parameter ‘input’
    input = -input;
    ...
  22. Replies
    6
    Views
    708

    The default keyword is also used in the...

    The default keyword is also used in the _Generic() expression selector. It still has to be inside the _Generic construct, so there's no way to just randomly scatter default around your code.
    ...
  23. You don't bind a name to a socket on the client...

    You don't bind a name to a socket on the client side. Just create the socket and then send/receive data. (You should send first so that the server, which is the more permanent process, knows to begin...
  24. Replies
    7
    Views
    1,425

    Correct. A factory method is a method that is...

    Correct.

    A factory method is a method that is called to build an instance of a class (or subclass). For this reason, you don't usually call factory methods using a class instance. Rather, you...
  25. Replies
    9
    Views
    834

    You have a node structure which (per the code)...

    You have a node structure which (per the code) contains members like this:


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

    A single-linked list, which is what you have...
Results 1 to 25 of 70
Page 1 of 3 1 2 3