Search:

Type: Posts; User: john.c

Page 1 of 20 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    2
    Views
    96

    It's hard for me to imagine a use case where I...

    It's hard for me to imagine a use case where I cared that an array was sorted but didn't care whether it was ascending or descending. Probably not worth a dedicated function.

    You could define...
  2. Replies
    6
    Views
    307

    @Exosomes, in glibc, if the "salt" starts with...

    @Exosomes, in glibc, if the "salt" starts with "$6$" then SHA-512 is used (and the salt is the letters from the second $ to the next $).
  3. Replies
    6
    Views
    307

    Thanks for the info. I took another look but...

    Thanks for the info. I took another look but still can't find the vulnerability. I'll probably take another look at it later today. Definitely let us know when you figure it out or are told. I wonder...
  4. Replies
    6
    Views
    307

    There doesn't seem to be any possible buffer...

    There doesn't seem to be any possible buffer overruns since all inputs use fgets calls and they are all properly limited. The strcats don't seem to be able to overflow either.


    Something strange...
  5. Replies
    3
    Views
    386

    What exactly did you do? (Post code/script.) How...

    What exactly did you do? (Post code/script.)
    How exactly did it not work?
  6. #include #include void...

    #include <stdio.h>
    #include <math.h>

    void Maclurin(float x, float es, int maxIter);

    int main()
    {
    Maclurin(1, 0.05 , 100);
    return 0;
    }
  7. Replies
    20
    Views
    680

    CHAR_BIT can never be less than 8. See 5.2.4.2.1...

    CHAR_BIT can never be less than 8.
    See 5.2.4.2.1 of the C11 standard.
  8. Replies
    4
    Views
    334

    Nobody tried to "figure it out".

    Nobody tried to "figure it out".
  9. Replies
    7
    Views
    383

    Your code doesn't make any sense. Presumably you...

    Your code doesn't make any sense.
    Presumably you mean something like this:


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

    char **f() // no need to pass the variable in
    {
  10. Replies
    13
    Views
    478

    Page 13 of N1570...

    Page 13 of N1570 says
  11. Replies
    13
    Views
    478

    If you want to ignore a parameter: #include...

    If you want to ignore a parameter:


    #include <stdio.h>

    int main(int argc, char **argv) {
    (void)argv;
    printf("%d\n", argc);
    return 0;
    }
  12. Replies
    9
    Views
    394

    You created the arrays to be a certain size....

    You created the arrays to be a certain size.
    That is the size they are.
    They do not magically change their size just because you try to access memory outside the array bounds.

    BTW, I didn't say...
  13. Replies
    9
    Views
    394

    Array a is m elements long. Array b is n elements...

    Array a is m elements long. Array b is n elements long.
    So neither of them is big enough to hold n + m elements.
  14. Maybe you are supposed to ignore a bit that...

    Maybe you are supposed to ignore a bit that overflows (at least under certain conditions). Then the answer is 1, as expected.
  15. Replies
    1
    Views
    378

    Presumably your first example is supposed to call...

    Presumably your first example is supposed to call foo1 and your second is supposed to call foo2 (with a properly defined s).

    The postfix increment operator has higher precedence than the...
  16. Assuming they are all supposed to be transformed...

    Assuming they are all supposed to be transformed into some kind of 2-d array, here are some possibilities.



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

    // For allocation of...
  17. Replies
    3
    Views
    397

    okay

    okay
  18. Replies
    3
    Views
    397

    pmatrix needs to be a triple pointer to be able...

    pmatrix needs to be a triple pointer to be able to set it to NULL in the caller.


    void freeMatrix(pixel *** pmatrix, size_t rows){
    for (int i = 0; i < rows; ++i)
    ...
  19. In the future, remember that it is best to post a...

    In the future, remember that it is best to post a complete program (headers,main,etc) so that we can easily run (or try to compile) it.

    The compiler does not know how to set a Planet to a char....
  20. Replies
    10
    Views
    565

    That's not the actual reason getchar returns an...

    That's not the actual reason getchar returns an int. The reason is so that EOF can be chosen to be a bit pattern that can never occur in a char (an "out-of-band" value). Obviously that means it must...
  21. Thread: Using modf()

    by john.c
    Replies
    2
    Views
    866

    #include #include int...

    #include <iostream>
    #include <cmath>

    int main() {
    float value = 123.456;
    float whole, part = std::modf(value, &whole);
    std::cout << value << '\n' << whole << '\n' << part << '\n';...
  22. Replies
    6
    Views
    510

    @christop, Obviously it's undefined behavior....

    @christop, Obviously it's undefined behavior. That's not the point. And I have no problem with printf printing "(null)". The point is how does the printf get called at all? Why doesn't it blow up as...
  23. Replies
    6
    Views
    510

    Dereferencing mystery?

    I find it strange that NULL is passed to printf below. Since p is NULL, it seems more likely that p->s would blow up before the function call.


    #include <stdio.h>

    typedef struct {
    char...
  24. Replies
    10
    Views
    970

    Your input file is text, not binary. If you need...

    Your input file is text, not binary.
    If you need your output to be binary, what exactly is the format?
    I've output to a text file below, one integer per line.
    Never say ios::in for an ifstream or...
  25. Replies
    8
    Views
    623

    ` 2 3 5 ...

    ` 2 3 5 7 11 13 17 19 23 29 31 37 41
    1: 1 1
    2: 2 2 1
    3: 4 ...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4