Search:

Type: Posts; User: Salem

Page 1 of 20 1 2 3 4

Search: Search took 0.20 seconds.

  1. Replies
    1
    Views
    5

    > float mod,result; mod here is an...

    > float mod,result;
    mod here is an uninitialised local variable, and nothing to do with the result of the mod function you just called in main.

    Maybe pass mod from main to this function as...
  2. > It needs to assign all nonzero values from 1st...

    > It needs to assign all nonzero values from 1st array to 2nd, from left to right in ascending order and
    > return number of significant ( that were assigned to 1st to 2nd ) elements of 2nd array. ...
  3. Pointers have no concept of the size of the thing...

    Pointers have no concept of the size of the thing they point to.
    If they did, unintentional buffer overflows would have been long banished to history.



    void foo ( int *bar ) {
    // no idea...
  4. Do you have code for that, or is it just a...

    Do you have code for that, or is it just a screen-shot from your assignment.

    > x1 should be 0.1 not 0.3


    for (i = 0; i < b ; i++, x = xnew ) {
    xnew = x + pow(c,i)* h;
    // figure out...
  5. So this? for (i = 0; i < b ; i++) { x =...

    So this?


    for (i = 0; i < b ; i++) {
    x = x + pow(c,i)* h;
    y = (6 * pow(x,2) + 29*x + 14) / (32 - pow(x,5));
    }
  6. Thread: hex increment

    by Salem
    Replies
    3
    Views
    78

    for ( i = 15 ; i >= 0 ; i-- ) { if ( ++key[i]...

    for ( i = 15 ; i >= 0 ; i-- ) {
    if ( ++key[i] ) break;
    // continues if a value rolls over from 0xff to 0x00
    }
  7. Thread: C - Stdin Buffer

    by Salem
    Replies
    9
    Views
    164

    The buffering state of a stream is irrelevant to...

    The buffering state of a stream is irrelevant to how a particular function operates with that stream.

    fgets will read characters until the buffer is full, a \n is seen or end of file.
    fread will...
  8. Well the first problem would be your broken loop,...

    Well the first problem would be your broken loop, where you initialise i, but increment the uninitialised j
    > for (i = 0; i < count; j++)

    Before you create a mass of code, make a separate file...
  9. Well you also need to link with the library as...

    Well you also need to link with the library as well.

    clang prog.c -lncurses
  10. char intermediary[len+1]; ...

    char intermediary[len+1];
    memcpy(intermediary,haystack,len);
    a = strrchr(intermediary,'\"');

    memcpy doesn't put \0 characters on the ends of strings.
  11. 1. Ncurses has far more functionality than...

    1. Ncurses has far more functionality than conio.h ever had. All you need to do is look.

    For example, getting a character without waiting.
    c - how to get a character from stdin without waiting...
  12. Your sort loop is on the right track. if...

    Your sort loop is on the right track.


    if (strcmp(contacts[i].firstname, contacts[j].firstname) > 0) {
    struct phonebook temp = contacts[i];
    contacts[i] = contacts[j];
    contacts[j] = temp;...
  13. Replies
    2
    Views
    109

    All string constants are in read-only memory, so...

    All string constants are in read-only memory, so you get a segfault if you try to write to them.

    str2 = " Long text 1";
    This works because all you're doing is setting a pointer to point to...
  14. Replies
    4
    Views
    130

    > arr[0]=tempfirst; These things should be...

    > arr[0]=tempfirst;
    These things should be outside your loops.
    You want to do them last, after you've moved the whole array.
  15. Replies
    2
    Views
    158

    You just did.

    You just did.
  16. Replies
    4
    Views
    125

    Well the OS has to physically map the 400MB of...

    Well the OS has to physically map the 400MB of memory you basically use as write-only memory.

    That's a lot of memory to write once, read once from.
  17. Cross-posted here -> Need guidance on how to make...

    Cross-posted here -> Need guidance on how to make a rectangle - C++ Forum
  18. I'm pretty sure all that nonsense results in...

    I'm pretty sure all that nonsense results in undefined behaviour.
  19. Replies
    3
    Views
    151

    Do something like rand() % 100

    Do something like
    rand() % 100
  20. Before the exec call, do this ...

    Before the exec call, do this


    dup2(pfd[READ], STDIN_FILENO);

    This will join the appropriate end of the pipe to the stdin of the child process.
  21. Replies
    2
    Views
    130

    Duplicate Function not returning date string...

    Duplicate
    Function not returning date string
  22. Replies
    14
    Views
    326

    Your first cut of C code should look like this....

    Your first cut of C code should look like this.
    It's basically all the bullet points of your assignment written as comments.


    int main ( ) {
    // a) Allow the user to enter their own...
  23. Replies
    3
    Views
    155

    Well you could step through the code with a...

    Well you could step through the code with a debugger.

    Like I did.


    $ gcc -g foo.c
    $ gdb -q ./a.out
    Reading symbols from ./a.out...done.
    (gdb) b substr
    Breakpoint 1 at 0x4008b9: file foo.c,...
  24. Replies
    3
    Views
    155

    So what's an example of a test case that you...

    So what's an example of a test case that you think should pass, but actually fails?
  25. Replies
    5
    Views
    320

    Can you please use "copy-as-text" in your IDE, or...

    Can you please use "copy-as-text" in your IDE, or "paste-as-text" in your browser.
    I'm fed up of fixing the colour eyesore that you post by default.

    Also, malloc and mysql_real_escape_string...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4