Search:

Type: Posts; User: rstanley

Page 1 of 20 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    12
    Views
    163

    You have to experiment with the various options...

    You have to experiment with the various options to indent, until you get the code to look like you want.

    Work with one or two related options at a time, make notes, then another one or two by...
  2. Replies
    12
    Views
    163

    My response is also valid to the second code...

    My response is also valid to the second code example you provided. It is important to point out errors in any code posted, no matter who actual wrote the code, or if it actually demonstrated a...
  3. Replies
    12
    Views
    163

    The C18 Standard does state: In most O/Ss,...

    The C18 Standard does state:

    In most O/Ss, argc is at least 1, and argv[0] is the program name, or full file path. If argc > 1, then the remainder of the command line arguments are options, file...
  4. Replies
    3
    Views
    144

    I don't use any macs but try: #include...

    I don't use any macs but try:

    #include "misc.h"

    // Instead of:

    #include "./misc.h"

    That is the normal way of including a file in the current directory. The "./" is not needed.
  5. Thread: Word Counting

    by rstanley
    Replies
    10
    Views
    414

    "5 pages of information" for one assignment???...

    "5 pages of information" for one assignment??? Seriously? One page at most, should have been sufficient! Your instructor needs to take a course on assignment creation! I also disagree with the...
  6. Thread: Word Counting

    by rstanley
    Replies
    10
    Views
    414

    Why do you think it is, "how it is supposed to...

    Why do you think it is, "how it is supposed to be"? Where in the instructions does it indicate that punctuation, such as a comma, or a period is part of a "word"??? or where does it indicate that...
  7. Thread: Word Counting

    by rstanley
    Replies
    10
    Views
    414

    "The word, word is a word." I would assume...

    "The word, word is a word."

    I would assume that any whitespace characters and any punctuation, are not part of any "word". Based on this, my example above, should consist of 6 "words", and the...
  8. Thread: Word Counting

    by rstanley
    Replies
    10
    Views
    414

    From the original post: Valid site for a simple...

    From the original post:
    Valid site for a simple word count, but this is a forum for the creation of C programs, and assisting the O/P's with answering their questions, and advising them on their...
  9. If Wait() and main() are in the same file as you...

    If Wait() and main() are in the same file as you show in the first example above, then you don't need a header file. Yes, you could create a header file even if they are in the same file, in...
  10. Replies
    9
    Views
    316

    I am running gcc version 10.2.1, on Debian...

    I am running gcc version 10.2.1, on Debian testing, and -O1, -O2, and -O3, as well as with no -O options, all with -std=c18, and the code runs as you expect it should, and all return 0.

    I cannot...
  11. Thread: macros???

    by rstanley
    Replies
    4
    Views
    266

    Yes, you could use a simple #define macro, but...

    Yes, you could use a simple #define macro, but debugging the code and maintaining it later, especially by a different programmer would be a nightmare! Not recommended!

    Copy & Paste would be a...
  12. If you assign a value to a variable larger than...

    If you assign a value to a variable larger than the maximum value it can hold, it rolls over. Basically it does a modulo, 259%256 == 3
  13. Replies
    20
    Views
    709

    int addition (int a, int b); The int before...

    int addition (int a, int b);

    The int before the function name, "addition" tells the compiler what type is being returned from the function. In this case, the integer type of the local variable,...
  14. Replies
    20
    Views
    709

    First of all, you really need to stop worrying...

    First of all, you really need to stop worrying about using the keyword, "extern" with functions! ALL functions are "extern" by default, so using "extern" on the function declaration or definition,...
  15. Replies
    20
    Views
    709

    You can call this function from main(), and it...

    You can call this function from main(), and it does execute the code in add(), however, without passing data to the function and returning a value, it really does nothing.

    #include <stdio.h>
    ...
  16. Replies
    20
    Views
    709

    I would also add warning options to your compile...

    I would also add warning options to your compile command:
    gcc -o hello -Wall -Wextra -Wpedantic file1.c main.c
  17. Replies
    20
    Views
    700

    It is always best to free any memory you have...

    It is always best to free any memory you have allocated using, malloc(), calloc(), or realloc(), then using valgrind under Linux, you can double check for any allocations you missed, along with other...
  18. Replies
    20
    Views
    700

    Short of taking a course in C Programming from a...

    Short of taking a course in C Programming from a qualified instructor, you need to study a good book on the C Programming Language, cover to cover, and do all the exercises at the end of each...
  19. Replies
    20
    Views
    709

    Plus, Rahul11, you need to get hold of one of...

    Plus, Rahul11, you need to get hold of one of the three books I listed above, and study it thoroughly!
  20. extern int x; extern is used to DELCARE a...

    extern int x; extern is used to DELCARE a variable, and specify that it is of type int. This line should go into file1.h.

    The line:
    #include "file1.h" should be in both "file1.c and "main.c"....
  21. First of all, you should avoid global variables...

    First of all, you should avoid global variables if at all possible. Define them in main() and pass them to functions called by main().

    A simple program may only consist of a few functions in one...
  22. Replies
    4
    Views
    317

    Please study the manpage for fopen()...

    Please study the manpage for fopen() thoroughly, as jimblumberg gave you above! That will give you all the information you need!
  23. Replies
    20
    Views
    660

    So are printf(), scanf() and many other Standard...

    So are printf(), scanf() and many other Standard Library functions that you would rather use than rewrite from scratch! Getopt() and getopt_long() are frameworks written, debugged, and proven, that...
  24. Replies
    8
    Views
    426

    You DECLARE extern global variables in the header...

    You DECLARE extern global variables in the header file.
    You DEFINE the same variables and initialize the const variables in One .c file, and then use them in any .c file that #includes the header...
  25. Replies
    20
    Views
    660

    awsdert: In reference to getopt() and...

    awsdert:
    In reference to getopt() and getopt_long():

    What requirement?

    It may not be part of the C Standard, but is so common, that is not an issue. There are version for Windows as well.
    ...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4