Search:

Type: Posts; User: Salem

Page 1 of 20 1 2 3 4

Search: Search took 0.20 seconds.

  1. No wonder you're seeing garbage.... $ gcc...

    No wonder you're seeing garbage....


    $ gcc -Wall -Wextra -O2 foo.c
    foo.c: In function ‘main’:
    foo.c:11:12: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘double’...
  2. Replies
    1
    Views
    60

    Which operating system and compiler are you...

    Which operating system and compiler are you using?

    C in and of itself doesn't know anything about printers.
  3. > When I key in 0.1 interval, it display the...

    > When I key in 0.1 interval, it display the values from 0 to 1. however, when I key in 0.01, it only display the values from 0 to 0.99.
    All floating point operations are approximations.
    0.01...
  4. Replies
    3
    Views
    129

    > what do you think guys is this a good idea or a...

    > what do you think guys is this a good idea or a waste of time ?
    It's a waste of time if you're following someone's outdated notion that you have to learn X before learning Y.

    Also, consider...
  5. Replies
    9
    Views
    206

    > why 2 here IT SHOULD BE 4 ????? Because an...

    > why 2 here IT SHOULD BE 4 ?????
    Because an array doesn't get bigger just by assigning values out of bounds.



    //shifting
    for (i = m - 1; i >= loc; i--) {
    a[i + n] = a;
    }
  6. Some thoughts. 1. Having so many global...

    Some thoughts.

    1. Having so many global variables makes it harder for you.

    2. A singly linked list makes it harder for you.

    3. Spreading bits of linked list code all over the place makes it...
  7. Well you need to send yourself a redraw message -...

    Well you need to send yourself a redraw message - or something.
    WM_SETREDRAW message (Winuser.h) - Win32 apps | Microsoft Docs
  8. Replies
    3
    Views
    160

    Every time you use ctrl-c / ctrl-v, you need to...

    Every time you use ctrl-c / ctrl-v, you need to stop coding and start thinking.

    Specifically, you need to think about how you generalise the thing you just copied.



    #include <cstddef>...
  9. Replies
    4
    Views
    198

    > I'm still getting "output isn't correct"...

    > I'm still getting "output isn't correct" (practicing on an autoevaluator platform) after trying both suggestions.
    You need to be very specific about what format the auto checker expects.

    For...
  10. Thread: Enumerators

    by Salem
    Replies
    2
    Views
    172

    It doesn't make much difference at all in C. ...

    It doesn't make much difference at all in C.

    They are just named constants of some integral type.
    So assigning one to another usually goes unremarked.


    #include <stdio.h>

    enum colours {
    ...
  11. Replies
    4
    Views
    294

    Well normally, you would use some kind of sensor....

    Well normally, you would use some kind of sensor.

    Laser rangefinder - Wikipedia
  12. Replies
    4
    Views
    294

    How about copy/pasting the text of your...

    How about copy/pasting the text of your assignment.

    Instead of a bunch of questions around what you imagine the problem/solution might be.
  13. > First of all, you cannot assume the order of...

    > First of all, you cannot assume the order of the members of a struct, in memory, despite the order you specify.
    Erm, yes you can.
  14. Looks like you didn't learn the lesson from last...

    Looks like you didn't learn the lesson from last time.

    Just do yourself a favour and stop digging these huge holes for yourself.


    $ gcc -Wall main.c
    main.c: In function ‘ProcessUser’:...
  15. Replies
    3
    Views
    251

    > Is it mean that we have a pointer that points a...

    > Is it mean that we have a pointer that points a struct with slots x,y,w,h,flags?
    > Do we need to define these kind of pointers like pointer to int or pointer to float?
    Let's illustrate your...
  16. Replies
    3
    Views
    214

    if ( sscanf(buff, "width %d - %*d,%*d,%d", &n1,...

    if ( sscanf(buff, "width %d - %*d,%*d,%d", &n1, &n2) == 2 )

    This will ignore lines not matching the expected format.
  17. Replies
    3
    Views
    214

    Use fgets() to read a whole line into memory. ...

    Use fgets() to read a whole line into memory.

    Then perhaps


    char buff[BUFSIZ];
    fgets(buff,BUFSIZ,f1);
    sscanf(buff, "width %d - %*d,%*d,%d", &n1, &n2);
  18. Replies
    3
    Views
    266

    No information? ...

    No information?

    http://www.libpng.org/pub/png/libpng-manual.txt

    There's a similar set function as well.
  19. Replies
    4
    Views
    357

    Add in a line somewhere like if ( i != 2 )

    Add in a line somewhere like

    if ( i != 2 )
  20. Replies
    4
    Views
    357

    Are you looking to just not print the second row,...

    Are you looking to just not print the second row, or are you trying to create a new new int[3, 6]; ?
  21. Replies
    2
    Views
    262

    > I'm trying to return a double pointer from a...

    > I'm trying to return a double pointer from a function. Here is my current code:
    But you have a 2D array - which isn't the same thing.

    char a[N] becomes a char *
    but
    char a[R][C] becomes char...
  22. int **n You can synthesise any n[x][y] kind of...

    int **n
    You can synthesise any n[x][y] kind of array, and each y can be different (ragged)


    n = malloc(x*sizeof(*n));
    for(i = 0 ; i < x ; i++)
    n[i] = malloc(y*sizeof(*n[i]));


    int *n[3]
  23. Replies
    1
    Views
    236

    Wow ... Fix all these first. $ gcc -Wall...

    Wow ...

    Fix all these first.


    $ gcc -Wall -Wextra main.c
    main.c:24:6: warning: return type of ‘main’ is not ‘int’ [-Wmain]
    void main()
    ^
    main.c: In function ‘main’:
  24. Replies
    55
    Views
    1,518

    If it's a botched attempt to tell you a signal...

    If it's a botched attempt to tell you a signal number, then 11 would indicate a segmentation fault.
  25. It was half an answer (aka a hint) to see how far...

    It was half an answer (aka a hint) to see how far you could then go by yourself.

    Apparently, not that far.

    Post your effort, not "I tried ... and it didn't work".
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4