Search:

Type: Posts; User: Matticus

Page 1 of 20 1 2 3 4

Search: Search took 0.03 seconds.

  1. Replies
    3
    Views
    2,464

    break is intended to break out of a loop or...

    break is intended to break out of a loop or switch case. Did you mean to use while instead of if on line 7?
  2. Replies
    4
    Views
    613

    If your code still isn't working, you need to...

    If your code still isn't working, you need to post the latest version. We don't know which bit of the [good] advice you chose to apply, and whether you've applied it correctly.

    To make it easier...
  3. You're reading and writing in binary, not text. ...

    You're reading and writing in binary, not text. In this context, '\0' does not behave as a string-terminating character. Hence it is printing the actual binary value of '\0'.

    Incidentally, when...
  4. Replies
    7
    Views
    894

    Read post #2 again, and do a little bit of...

    Read post #2 again, and do a little bit of research.
  5. Replies
    7
    Views
    894

    Your code? What you've posted is extremely...

    Your code? What you've posted is extremely similar to the code here: c - Client connects to server randomly - Stack Overflow

    Furthermore, you've provided no answers to the questions I asked. ...
  6. Replies
    7
    Views
    894

    If you're completely new to C, I would recommend...

    If you're completely new to C, I would recommend starting with the basics, and tackling network and thread programming later on.

    What type of sockets are you using?
    Does your program use the...
  7. Start with a simple practice program to test...

    Start with a simple practice program to test passing a struct pointer to a function and traversing the list. Something like this:



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

    struct stest
    {
    ...
  8. Yes, just keep track of the largest value while...

    Yes, just keep track of the largest value while looping through the structs. If a larger magnitude is found, save this value (for subsequent comparisons) along with the corresponding value of N.
  9. You asked this question on your other thread,...

    You asked this question on your other thread, let's keep it there -> keep getting an to me unknown error
  10. Replies
    3
    Views
    353

    It would be easier to help you if the prompts...

    It would be easier to help you if the prompts were translated to English. Also, you should provide the inputs that cause the problems you're seeing (what input are you giving it, what output do you...
  11. If you want to access all allocated structs, have...

    If you want to access all allocated structs, have your function receive a pointer to struct. Then you can move through the structs as if it were an array.

    A shorthand way of accessing an element...
  12. Replies
    3
    Views
    353

    You need to pass the address of the variable to...

    You need to pass the address of the variable to scanf.
  13. Replies
    18
    Views
    1,192

    You may want to run your code through a debugger...

    You may want to run your code through a debugger to find the problem. You are likely accessing memory you aren't allowed to.

    You should not cast malloc, and you should check the return value of...
  14. Replies
    4
    Views
    360

    You need to declare the functions in the header...

    You need to declare the functions in the header file, like so:



    #ifndef RATIONAL_H
    #define RATIONAL_H

    typedef struct {
    long numerator, denumerator;
    }rational;
  15. Replies
    5
    Views
    1,140

    There's an explanation and simple fix for that...

    There's an explanation and simple fix for that here: FAQ > How do I avoid a "dangling" newline when reading single character user input? - Cprogramming.com
  16. Replies
    2
    Views
    538

    There could be several reasons for this issue. ...

    There could be several reasons for this issue. Post a complete (preferably simplified) version of the program that exhibits the problem.



    To compare strings in C, you should be using strcmp.
  17. Replies
    5
    Views
    695

    I second john.c's suggestion. You might consider...

    I second john.c's suggestion. You might consider reading up on the BMP file format and creating your own small library to manipulate the images however you'd like.
  18. You're still trying to use the length of the...

    You're still trying to use the length of the string to determine whether to clear the input buffer, which will not work.

    Check for the presence of the newline to determine if the entire input has...
  19. Replies
    10
    Views
    1,551

    That can be argued, yes, but in many cases you...

    That can be argued, yes, but in many cases you can avoid using goto by carefully planning and restructuring your logic to avoid heavily nested loops.
  20. Replies
    10
    Views
    1,551

    Yes, or any other input command. Then...

    Yes, or any other input command.



    Then that's the size you need to pass to fgets. As it stands, you're giving it sizeof(userInput) which is 64.
  21. Just so you know, use "%p" when printing a...

    Just so you know, use "%p" when printing a pointer.



    #include <stdio.h>

    int main(void)
    {
    int n = 5;
    int *p = &n;
  22. Thread: Holiday Feels

    by Matticus
    Replies
    3
    Views
    600

    Gifts are wrapped. Food ingredients are stocked....

    Gifts are wrapped.
    Food ingredients are stocked.
    Beer is chilling.
    Wife is going out of town.

    Looking forward to the rare one-man party. :)
  23. Replies
    10
    Views
    1,551

    char userInput[64] // ... fgets(userInput,...

    char userInput[64]

    // ...

    fgets(userInput, sizeof(userInput), stdin);

    if(strlen(userInput) > 10) {
    // ...
  24. Replies
    2
    Views
    336

    Are you sure you're supposed to be moving the...

    Are you sure you're supposed to be moving the cursor around the console like that?

    These types of problems usually rely on calculating numbers of spaces to print in order to achieve the desired...
  25. You should post any code you have written so far...

    You should post any code you have written so far (in code tags), and explain what specific problem you need help with.
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4