Search:

Type: Posts; User: Hodor

Page 1 of 20 1 2 3 4

Search: Search took 0.02 seconds.

  1. I wouldn't worry about your age. 25 is pretty...

    I wouldn't worry about your age. 25 is pretty young. I don't know what uni/college is like where you are but here in Australia there are lots of people older than 25 attending even at undergraduate...
  2. Replies
    4
    Views
    184

    The K&R approach is pretty bad, but using conio.h...

    The K&R approach is pretty bad, but using conio.h is arguably worse. At least, as bad as it is, the K&R approach is portable. Try compiling your solution using conio.h using anything but Windows or...
  3. Replies
    4
    Views
    184

    Your printf() is wrong as well. Change to: ...

    Your printf() is wrong as well. Change to:



    printf ("%d\n", *pn);

    return c;

    }
  4. Replies
    4
    Views
    184

    Have you implemented getch() and ungetch()? ...

    Have you implemented getch() and ungetch()?


    Edit: the functions are also provided at the bottom of the first post in this thread: Complex declarations & ?error in Kernighan/Ritchie?
  5. Replies
    10
    Views
    262

    It was late at night and I was merely quoting....

    It was late at night and I was merely quoting. What I meant to write is that int function() is not the same as int function(void) in the current and previous version of the standard.
  6. Replies
    10
    Views
    262

    Strictly speaking void main() is quite different...

    Strictly speaking void main() is quite different to void main(void), as for any other function. The next version of the standard may say that function() is the same as function(void) (it's being...
  7. for (count = 1; count

    for (count = 1; count <= 9; count++) // generate random number loop digit from 0 -> 9
    {
    num = rand() % limit;
    printf("%d", num);
    }




    The code...
  8. Replies
    4
    Views
    235

    @san12345 do you want combinations or...

    @san12345 do you want combinations or permutations?
    @rusyoldguy are you sure your program is complicated enough? Is it the enterprise solution to the problem? Additionally, This is the C sub-forum,...
  9. Replies
    4
    Views
    182

    You don't. The string literal could be constant...

    You don't. The string literal could be constant or non-constant (it's not defined by the C Standard). But treating it as non-constant is undefined behaviour so best to just always treat it as constant
  10. Yes, it's in memory printf("address of...

    Yes, it's in memory



    printf("address of person : %p \n", &person);



    printf("what Ptr points to : %p \n", Ptr);
  11. It's not always necessary to allocate dynamic...

    It's not always necessary to allocate dynamic memory but the pointer has to point to something valid before you use it (called dereferencing). E.g.



    #include <stdio.h>

    #include <stdlib.h>
    ...
  12. Replies
    6
    Views
    241

    I hate VLAs even when they're done "right"

    I hate VLAs even when they're done "right"
  13. Replies
    5
    Views
    235

    I can answer your question very easily (for a...

    I can answer your question very easily (for a start look at line 23 and what the condition is) but I have to wonder what you're trying to achieve. If you're trying to learn programming then, I have...
  14. Another one ticked off the list then ;) You could...

    Another one ticked off the list then ;) You could muck around with lines 30 and 31 because the break isn't 100% necessary because you're checking ctr in the main loop anyway but it's quite readable...
  15. Well, PsychoBandit was polite enough to respond...

    Well, PsychoBandit was polite enough to respond 10 hours ago here : c - I have error in showing the entered Resistor Values at the summary (last part of program) - Stack Overflow

    but haven't seen...
  16. You'll need a count variable as well as 'p'...

    You'll need a count variable as well as 'p' because you don't want to compare the prime number itself ('p') to 'input'. This is because you want to know what the 10001st (for example) prime number...
  17. Replies
    8
    Views
    284

    I hope you're not serious

    I hope you're not serious
  18. Replies
    9
    Views
    224

    It stores an aggregate of types

    It stores an aggregate of types
  19. I'm glad that's all cleared up

    I'm glad that's all cleared up
  20. If you haven't learned arrays then why are you...

    If you haven't learned arrays then why are you expected to print an... array?
  21. I'm not sure why it wouldn't work. Maybe the...

    I'm not sure why it wouldn't work. Maybe the mingw version is the problem... dunno sorry



    #include <numeric>
    #include <iostream>

    int main () {
    int a = std::gcd(15,5);
    std::cout <<...
  22. And I like your solution (a lot) I probably...

    And I like your solution (a lot)

    I probably wouldn't have used __gcd() but only because it's non-standard (although if your code is C++ there is always std::gcd() for c++17 or later). Other than...
  23. Replies
    5
    Views
    171

    uint32_t ParseDictionary(DICTIONARY *dict[],...

    uint32_t ParseDictionary(DICTIONARY *dict[], char** args, uint32_t argc)

    {

    uint32_t dict_len = (sizeof (dict)/sizeof (dict[0]));




    First, the function should be
  24. Replies
    10
    Views
    224

    Ok, well now you know how to turn warnings on :)...

    Ok, well now you know how to turn warnings on :) This might be controversial but when I was at uni if we submitted a program that had a single warning we'd get a zero. Harsh? Not really in my...
  25. Replies
    10
    Views
    224

    It should have been given a warning. How are you...

    It should have been given a warning. How are you compiling your programs (e.g. from the command line or using and IDE)?
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4