Search:

Type: Posts; User: Salem

Page 1 of 20 1 2 3 4

Search: Search took 0.26 seconds; generated 6 minute(s) ago.

  1. Replies
    14
    Views
    159

    Seems like one of those pointless exercises like...

    Seems like one of those pointless exercises like add two numbers without using +

    It seems the OP is lumbered with a tutor who thinks magic tricks is how you teach programming.
  2. Replies
    9
    Views
    121

    > for comparison reasons we were given an...

    > for comparison reasons we were given an executable file that holds an efficient code (we can't see the code).
    > we are supposed to try and make an even more efficient program.
    How do you compare...
  3. Replies
    14
    Views
    159

    > while (power--) // loops 28 times - CPU...

    > while (power--) // loops 28 times - CPU overloading - too expensive
    So initialise b once, and do one b /= 2 for each loop iteration.

    I've no idea what you're trying to prove here, except how...
  4. Replies
    9
    Views
    121

    That's a why, not a what. If you want more...

    That's a why, not a what.

    If you want more specific help, post the text of the challenge question.
  5. Replies
    14
    Views
    159

    That's no different to what you started with....

    That's no different to what you started with.
    printf("Exponent = %d\n", ((binary >> 23) & 255) - 127);
  6. Replies
    9
    Views
    121

    What are you trying to show?

    What are you trying to show?
  7. Replies
    14
    Views
    159

    Bit-fields or maths. #include ...

    Bit-fields or maths.


    #include <stdio.h>
    #include <math.h>
    int main ( ) {
    union {
    float x;
    struct {
    // assumes bit fields are arranged LSB first
  8. Replies
    9
    Views
    121

    > for (int i = 5; i

    > for (int i = 5; i <= sqrt(num); i = i + 6)
    Precalculate the square root, you're doing this every time around the loop.

    > for (int i = 0; i < run_n / NUM_THREADS; ++i)
    Not sure why you're not...
  9. Replies
    3
    Views
    97

    https://faq.cprogramming.com/cgi-bin/smartfaq.cgi?...

    https://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1044844545&id=1043284392

    If you want to do more than just print text (using cout), then you'll need
    Console Functions - Windows Console |...
  10. Replies
    1
    Views
    99

    Your comments document the language, not what...

    Your comments document the language, not what your program does.
    Although having said that, some tutors seem to like that kind of stuff.

    The only semi-useful comment would be the one "/* These...
  11. Replies
    26
    Views
    479

    > qsort( maps->buff, maps->size, sizeof(struct...

    > qsort( maps->buff, maps->size, sizeof(struct paw_map), paw_compare_maps );
    Your size should be the number of elements, not the number of bytes.
  12. Replies
    2
    Views
    192

    What sort of problems are you having? (we don't...

    What sort of problems are you having? (we don't know, you didn't post code).

    How far have you got?
    - open and close the file
    - read one word from the file and print it using printf
    - read all...
  13. Replies
    26
    Views
    479

    So how does that differ from all the other public...

    So how does that differ from all the other public functions in your other source files?

    Does 'nm ./lib/libpaw.so' tell you anything about what symbols are present?
  14. If you want to know what happened on a per file...

    If you want to know what happened on a per file basis, just type
    git log path/to/file
    It will tell you just those commits which affected that file.

    Similarly for some sub-directory, like the one...
  15. Replies
    26
    Views
    479

    > /usr/bin/ld: chkpaw.c:(.text+0x5d): undefined...

    > /usr/bin/ld: chkpaw.c:(.text+0x5d): undefined reference to `paw_unload_app'
    This usually means
    - you didn't implement that function.
    - you implemented it, but it's static (or hidden) for some...
  16. for (i = 1; str[i] != '\0'; ++i); Is no...

    for (i = 1; str[i] != '\0'; ++i);

    Is no different to this, having gone round the loop once.
    for (i = 0; str[i] != '\0'; ++i);

    Compare with


    int main(void) {
    unsigned i, count;
  17. Replies
    1
    Views
    142

    Install it - Git for Windows...

    Install it - Git for Windows

    Familiarise yourself with various workflow patterns
    - 5 Git Workflows & Branching Strategy to deliver better code
    - Git Workflow | Atlassian Git Tutorial

    Use it.
  18. Replies
    7
    Views
    336

    Yes, that's pretty much how it would work.

    Yes, that's pretty much how it would work.
  19. Replies
    7
    Views
    336

    You have something like this void foo_FC80 (...

    You have something like this


    void foo_FC80 ( ) {
    if ( ... ) {
    } else {
    // JMP $EE0A in the stack frame of baz()
    }
    }
    void bar() {
  20. Replies
    15
    Views
    527

    Beware that the LSB of rand() might not be all...

    Beware that the LSB of rand() might not be all that it seems.
    Question 13.18
  21. Replies
    7
    Views
    256

    cant print correctly a long double in C - Stack...

    cant print correctly a long double in C - Stack Overflow
    The problem stems from MinGW using the Microsoft runtime library (the code that implements printf).
    This is all well and good until you get...
  22. Replies
    4
    Views
    428

    So run the code in the debugger and find out more...

    So run the code in the debugger and find out more information.

    1. Compile with debug information
    gcc -g -o client client.c

    2. Load into the debugger
    gdb ./client

    3. At the next prompt type...
  23. You can use strrchr...

    You can use strrchr to find the last '.' in a string.
  24. Replies
    2
    Views
    522

    In your makefile (or some pre-build step), do ...

    In your makefile (or some pre-build step), do


    echo 'const char *version="'$(git describe --abbrev = 4 --always --tags)'";"' > version_info.c


    Then compile and link with that file, with an...
  25. Replies
    27
    Views
    1,079

    > If the conditional falls through (in other...

    > If the conditional falls through (in other words, the 'else' case), there are instructions to discard the subroutine address from the stack
    > and then jump to a completely different part of the...
Results 1 to 25 of 495
Page 1 of 20 1 2 3 4