Search:

Type: Posts; User: sonjared

Page 1 of 3 1 2 3

Search: Search took 0.01 seconds.

  1. The expected behavior is not clear. Please...

    The expected behavior is not clear. Please provide input and corresponding output examples.
  2. The whole point of the clearKeyboardbuffer...

    The whole point of the clearKeyboardbuffer function is to remove characters remaining in the stream. Specifically that would be a trailing '\n' left over by mixing formatted input (eg. scanf) and...
  3. clearKeyboardBuffer is called unconditionally,...

    clearKeyboardBuffer is called unconditionally, but in the case that choiceint is 3, there are no remaining characters in the stream. Therefore getchar will block for more input.
  4. Replies
    7
    Views
    984

    As long as we are making improvements to the...

    As long as we are making improvements to the code, we may as well fix everything:


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

    int main(void)
    {
    int i = 3;
  5. Replies
    21
    Views
    50,235

    Try running the code and see. But do note that...

    Try running the code and see. But do note that the Windows console does not support rich text. Changing the font size is an all or nothing effect with the program I posted, and will continue to be...
  6. Replies
    21
    Views
    50,235

    Try this command to build your program: gcc...

    Try this command to build your program:


    gcc code.c -o -lkernel32
  7. Replies
    21
    Views
    50,235

    Where did you get gcc and how did you install it?...

    Where did you get gcc and how did you install it? The two usual suspects are through MinGW or Cygwin.
  8. Replies
    21
    Views
    50,235

    You are using gcc on Windows, is that through...

    You are using gcc on Windows, is that through MinGW or Cygwin?
  9. Narrow your problem down into something simpler,...

    Narrow your problem down into something simpler, such as finding the first weekday of the year. Then it is a simple hop to finding the first weekday of any month, and from there the first Tuesday....
  10. Replies
    21
    Views
    50,235

    Are you linking with Kernel32.lib or...

    Are you linking with Kernel32.lib or Kernel32.dll? The example uses the Windows API to hook into the console, and if you're building manually from the command line you'll need to link with the...
  11. Replies
    21
    Views
    50,235

    Here is a simple example of setting the console's...

    Here is a simple example of setting the console's font size:


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

    int GetFontSize(HANDLE windowHandle, COORD *size)
    {
    ...
  12. Replies
    9
    Views
    2,111

    choice is used to control the loop, but never...

    choice is used to control the loop, but never modified within the loop body. Here is a function you can use to flush stdin up to the next line break:


    void flush_line(void)
    {
    if...
  13. Unless bytesremaining is a multiple of 8 such...

    Unless bytesremaining is a multiple of 8 such that it could reach 0 exactly, wrapping the unsigned value is practically guaranteed.
  14. Array subscripts must be of an integer type. Due...

    Array subscripts must be of an integer type. Due to type promotions, when you add an integer and a double, the result type is double. This means that in for example


    filter[i+r2][k+c2]

    i+r2...
  15. Replies
    3
    Views
    737

    On a slight tangent, the return value from main...

    On a slight tangent, the return value from main is an error code. Zero represents success and non-zero represents some code that the consuming process presumably recognizes. As such, returning either...
  16. Replies
    3
    Views
    737

    You are not getting output because there are no...

    You are not getting output because there are no output statements. Rather than returning the result from main, try printing it with printf. Returning from main simply terminates the program, and...
  17. The makefile is looking for a file that does not...

    The makefile is looking for a file that does not exist in the expected location. The missing file is generalizedfourierdescriptor.cpp, is it present anywhere in the source base you are trying to...
  18. Thread: Linked Lists

    by sonjared
    Replies
    18
    Views
    3,915

    This opens up an interesting discussion. If...

    This opens up an interesting discussion. If malloc fails and the program has not previously requested sufficient memory to complete execution, what other option is there than to terminate as...
  19. Which subsequently is evaluated as i = j;...

    Which subsequently is evaluated as


    i = j;
    if (i != 0)
    c[i][j] = 0;

    Not everyone may be aware of the implicit comparison against 0. :)
  20. Replies
    2
    Views
    789

    "Header" is not meaningful, and "properties" is...

    "Header" is not meaningful, and "properties" is incomplete as well as unconventional terminology. How about "Employee is a more specialized form of Person"?
  21. Thread: Linked Lists

    by sonjared
    Replies
    18
    Views
    3,915

    Good question. Another good question would be...

    Good question. Another good question would be what if the host system does not release allocated memory on process termination. How would you solve those two problems?

    Another improvement could be...
  22. Thread: Linked Lists

    by sonjared
    Replies
    18
    Views
    3,915

    I disagree. Look at the description of the...

    I disagree. Look at the description of the problem from post #4 and you'll see that generating a list from a string is a very small part of the program. Also, given the utterly simple nature of the...
  23. Assuming the modern practices and new standards...

    Assuming the modern practices and new standards do not scare students off entirely. C++ has grown more and more expert friendly over the years, it's hard not to notice and be concerned for beginners...
  24. Thread: Linked Lists

    by sonjared
    Replies
    18
    Views
    3,915

    That's a shame. But as far as how to go about it,...

    That's a shame. But as far as how to go about it, it is quite simple and essentially nothing changes with how a list of any other type might be managed:


    #include <stdio.h>
    #include <stdlib.h>
    ...
  25. This is a moving target to the point where a...

    This is a moving target to the point where a curriculum would be outdated before it was even rolled out. Should teachers attempt to remain relatively up-to-date? Absolutely. But there is a certain...
Results 1 to 25 of 66
Page 1 of 3 1 2 3