Search:

Type: Posts; User: Hodor

Page 1 of 20 1 2 3 4

Search: Search took 0.02 seconds.

  1. Replies
    8
    Views
    144

    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.
  2. Replies
    8
    Views
    144

    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...
  3. 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...
  4. Replies
    4
    Views
    195

    @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,...
  5. Replies
    4
    Views
    142

    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
  6. 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);
  7. 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>
    ...
  8. Replies
    6
    Views
    175

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

    I hate VLAs even when they're done "right"
  9. Replies
    5
    Views
    177

    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...
  10. 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...
  11. 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...
  12. 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...
  13. Replies
    8
    Views
    214

    I hope you're not serious

    I hope you're not serious
  14. Replies
    9
    Views
    188

    It stores an aggregate of types

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

    I'm glad that's all cleared up
  16. 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?
  17. 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 <<...
  18. 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...
  19. Replies
    5
    Views
    145

    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
  20. Replies
    10
    Views
    161

    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...
  21. Replies
    10
    Views
    161

    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)?
  22. Replies
    10
    Views
    161

    Try printf(" % d ", content[i]);

    Try printf(" % d ", content[i]);
  23. Broken on my Raspberry Pi (char defaults to...

    Broken on my Raspberry Pi (char defaults to unsigned). Change line 12 to int c;
  24. Replies
    18
    Views
    257

    Well, the compilers have been doing it since at...

    Well, the compilers have been doing it since at least 1994 it seems. I'm tempted to compile the test with Lattice C on my Amiga but I can guess that it will behave the same. It may as well be de...
  25. Replies
    18
    Views
    257

    I've changed my mind and now think it's undefined...

    I've changed my mind and now think it's undefined as you said. See my edit (J.5.11p1).

    Edit: To be fair I've been discussing this for 2 hours now with very experienced C programmers without...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4