Search:

Type: Posts; User: Salem

Page 1 of 20 1 2 3 4

Search: Search took 0.20 seconds.

  1. 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...
  2. 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
  3. Replies
    3
    Views
    113

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

    > 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...
  5. Thread: Enumerators

    by Salem
    Replies
    2
    Views
    143

    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 {
    ...
  6. Replies
    4
    Views
    249

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

    Well normally, you would use some kind of sensor.

    Laser rangefinder - Wikipedia
  7. Replies
    4
    Views
    249

    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.
  8. > 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.
  9. 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’:...
  10. Replies
    3
    Views
    231

    > 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...
  11. Replies
    3
    Views
    200

    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.
  12. Replies
    3
    Views
    200

    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);
  13. Replies
    3
    Views
    246

    No information? ...

    No information?

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

    There's a similar set function as well.
  14. Replies
    4
    Views
    301

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

    Add in a line somewhere like

    if ( i != 2 )
  15. Replies
    4
    Views
    301

    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]; ?
  16. Replies
    2
    Views
    233

    > 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...
  17. 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]
  18. Replies
    1
    Views
    216

    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’:
  19. Replies
    54
    Views
    1,359

    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.
  20. 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".
  21. It depends how complicated your expressions are....

    It depends how complicated your expressions are.

    Given your examples, a simple


    int n1, n2;
    char op;
    if ( sscanf(output,"%d%c%d",&n1,&op,&n2) == 3 ) {
    if ( op == '+' )
    }
  22. Replies
    1
    Views
    225

    Lookup isprint() in ctype.h

    Lookup isprint() in ctype.h
  23. Replies
    3
    Views
    267

    Well somewhere, you need to initialise your key...

    Well somewhere, you need to initialise your key string.
    char key[] = "hello";

    Then you need an index and a count.
    int key_index = 0;
    int key_count = 5;


    > If (keyIsNotExhaust) Encryption =...
  24. Replies
    11
    Views
    535

    > Is this how it would happen to encrypt and...

    > Is this how it would happen to encrypt and decrypt?
    Have you tested it?

    At some point, you'll have been given some example inputs and expected outputs.
  25. Sure is. #include #include...

    Sure is.


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

    typedef struct {
    int bar;
    } foo_st;
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4