Search:

Type: Posts; User: rstanley

Page 1 of 20 1 2 3 4

Search: Search took 0.01 seconds.

  1. You placed a '{' char before main() not after.

    You placed a '{' char before main() not after.
  2. Also look at the printf() statement for the 2nd...

    Also look at the printf() statement for the 2nd child and find the extraneous " in the data.
  3. Replies
    2
    Views
    103

    Without seeing the code we cannot comment on the...

    Without seeing the code we cannot comment on the error.

    Why would you need an alternative to string.h?

    Turn on your warnings in the compiler, and turn up the warning level to the highest level....
  4. Replies
    2
    Views
    115

    If you are correcting/maintaining an existing C...

    If you are correcting/maintaining an existing C application, or adding some functionality, you should use the Standard that was used to compile that app. Check the Makefile or documentation to...
  5. Replies
    1
    Views
    73

    You don't "have" to put anything in a header file...

    You don't "have" to put anything in a header file you create, if your program consists of only one .c file.

    If your program has multiple .c files with function definitions and function calls in...
  6. They are two different variables, the local in...

    They are two different variables, the local in the stack segment, and the global in the global data segment! The local will HIDE the global of the same name, and you, or someone else maintaining...
  7. @gajya In C, a local variable of the same name...

    @gajya

    In C, a local variable of the same name as a Global variable, will hide the Global.

    Simple solutions:

    1) Don't use global variables if at all possible! Define them in main() (Or...
  8. The scope resolution operator is only for C++ not...

    The scope resolution operator is only for C++ not C. There may be compilers that allow this as an extension, but not gcc using -std=c18. I have not experimented with any other options.
  9. @elonmusk The two books I recommend are as...

    @elonmusk

    The two books I recommend are as follows:

    C Programming, A Modern Approach
    Author: K. N. King

    C Primer Plus, 6th Edition
    Stephen Prata
  10. Replies
    7
    Views
    175

    Following the style of your code, this might be...

    Following the style of your code, this might be my version:

    #include <stdio.h>
    #include <ctype.h> // For isspace()

    /**
    ** This version still has it's problems.
    ** Empty line, just the...
  11. Replies
    7
    Views
    175

    I do see why you initialize words to 1; I would...

    I do see why you initialize words to 1; I would have written this a little differently.
  12. Replies
    7
    Views
    175

    You have several problems here. When your...

    You have several problems here.

    When your first getchar() gets a space, the second gets the next char after the space, turning the whole line into one big word!

    Look at the following with my...
  13. Replies
    3
    Views
    101

    Actually you could input them using command line...

    Actually you could input them using command line arguments, but outputting them would be the trick! ;^)

    $ ./prog Tuesday Wednesday ...

    Also, in your code, you are overwriting each word with the...
  14. Replies
    3
    Views
    101

    The C language consists of aproximatly 44...

    The C language consists of aproximatly 44 keywords, and approximately 47 operators, and many rules concerning them.

    All the rest are contained within the Standard Library, a set of pre-compiled...
  15. Replies
    4
    Views
    217

    @rusyoldguy We are here for advising the OP's...

    @rusyoldguy

    We are here for advising the OP's on the code that they write, not to code a possible solution for them.
  16. Replies
    4
    Views
    217

    No, you would need to write that yourself. Not...

    No, you would need to write that yourself. Not that difficult.
  17. Yes, display() does return the pointer. You do...

    Yes, display() does return the pointer.

    You do not capture the return from display(). Either capture the return value, or better still, declare display() as void.


    void display(struct student...
  18. Replies
    8
    Views
    195

    Why do you feel the need to reinstall...

    Why do you feel the need to reinstall Code::Blocks? That will not correct your code!

    gets() has been removed from the C11 Standard. You should use fgets() instead. fgets() does bring in the...
  19. Blank lines between functions, and indentation of...

    Blank lines between functions, and indentation of 2, 4, or 8 spaces.

    be careful about copy, and pasting from an IDE, as some hidden formatting will screw up the Code here. Only pure ASCII text!
    ...
  20. Replies
    8
    Views
    195

    No, it's not! You don't have your warnings...

    No, it's not! You don't have your warnings turned on and turned up to full!!!

    Code::Blocks is an IDE (editor), NOT a compiler! Code::Blocks calls the compiler, and other external applications....
  21. @Deus_Venatus There are many problems with...

    @Deus_Venatus

    There are many problems with this code, It obviously cannot compile, or if it did, it did so with warnings turned off!



    int main(double a, double b, double c)

    //main is...
  22. Debian testing: gcc (Debian 9.2.1-8) 9.2.1...

    Debian testing:

    gcc (Debian 9.2.1-8) 9.2.1 20190909

    gcc --std=c18

    C18 is the ISO name for what some call C17.
  23. Replies
    3
    Views
    169

    You have to capture the return value from rand(),...

    You have to capture the return value from rand(), and keep count of how many values captured from rand(), in the while loop, then after the loop, divide the total by the count to get the average.
    ...
  24. Replies
    5
    Views
    215

    Two other problems in addition to @jimblumberg's...

    Two other problems in addition to @jimblumberg's comments.

    fflush(stdin) should NEVER be used! fflush() is for output file only! fflush(stdin) is a perfect example of Undefined Behavior!

    Your...
  25. Replies
    12
    Views
    201

    It is not necessarily DDoS. There are many...

    It is not necessarily DDoS. There are many reasons the site is not responsive. I suspect they are working on whatever the issue is.

    DDoS is probably at the very bottom of the list of...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4