Search:

Type: Posts; User: Salem

Page 1 of 20 1 2 3 4

Search: Search took 0.19 seconds.

  1. Replies
    9
    Views
    65

    I would make damn sure lcd_delayus() is working...

    I would make damn sure lcd_delayus() is working as advertised.
  2. > As far as I can understand, its checking if the...

    > As far as I can understand, its checking if the number of scanned variables is 2.
    That is correct.


    > Another thing, The return 0; that you have given, why return that to main?? I can't see...
  3. Pretty much the same way char names[5][10]; ...

    Pretty much the same way

    char names[5][10];

    Then a loop of
    scanf( "%s",names[i] );
  4. Replies
    9
    Views
    65

    > for(i=0; i

    > for(i=0; i<SystemCoreClock/4000000; i++)...
    I would be suspicious of this doing anything useful given i is an unsigned char.
    Is the calculation even remotely within range?

    > &nbsp;);
    I would...
  5. Your use of global variables is awful.

    Your use of global variables is awful.
  6. Well if you insist on a bunch of bad ideas.... ...

    Well if you insist on a bunch of bad ideas....


    int main() //!!yes, really, int - for sure.
    {
    printf("please type two variables, a and b\n\n");
    int VarA=0;
    int VarB=0;...
  7. The matrix that update receives is only a copy of...

    The matrix that update receives is only a copy of the pointer.
    So changing it locally doesn't change it in main.

    That also leads to the freeing problem, because the realloc will free the old...
  8. > scanf("%c",&array[i]); If you want to read the...

    > scanf("%c",&array[i]);
    If you want to read the next printable character (ignoring all white space), then add a leading space to your scanf format string.
    scanf(" %c",&array[i]);
  9. Replies
    4
    Views
    81

    float area(int base,int height) { float...

    float area(int base,int height)
    {
    float result;

    result = base*height;
    printf("DEBUG: area=%f\n",result);

    return result;
    }
  10. Replies
    10
    Views
    126

    Well we can't test your code because you posted a...

    Well we can't test your code because you posted a PICTURE of it.

    Copy/paste your code and place code tags around it.


    // paste your code here, directly from your code editor.
  11. Thread: Pointer question

    by Salem
    Replies
    6
    Views
    88

    Try it with gcc -Wall -Wextra -o test test.c

    Try it with
    gcc -Wall -Wextra -o test test.c
  12. Well ch is an undeclared and uninitialised...

    Well ch is an undeclared and uninitialised variable in your code.
  13. Replies
    4
    Views
    81

    > 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...
  14. > 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. ...
  15. 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...
  16. Replies
    4
    Views
    109

    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...
  17. Replies
    4
    Views
    109

    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));
    }
  18. Thread: hex increment

    by Salem
    Replies
    3
    Views
    90

    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
    }
  19. Thread: C - Stdin Buffer

    by Salem
    Replies
    9
    Views
    179

    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...
  20. 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...
  21. 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
  22. 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.
  23. 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...
  24. 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;...
  25. Replies
    2
    Views
    118

    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...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4