Search:

Type: Posts; User: Salem

Page 1 of 20 1 2 3 4

Search: Search took 0.22 seconds.

  1. Some fun for a lazy Saturday :) ...

    Some fun for a lazy Saturday :)


    #include<stdio.h>

    #define ASIZE 5

    void zigzag(int a[ASIZE][ASIZE]) {
    int flip = 0;
    for( int r = 0 ; r < ASIZE ; r++ ) {
  2. > Thanks. fixed those but there still is the...

    > Thanks. fixed those but there still is the segfault.
    At some point, you have to recognise that the current list is empty (head == NULL), and just return the freshly created node as being the sole...
  3. You need to make sure your new_node->next is...

    You need to make sure your new_node->next is NULL.

    > SinglyLinkedListNode *new_node = (SinglyLinkedListNode*)malloc(sizeof(SinglyLinkedListNode));
    If this really is C++, then you should be using...
  4. Do you want to make a copy of the data? int...

    Do you want to make a copy of the data?


    int from[3][3];
    int to[9];
    // some code to copy from -> to


    Or you do want to modify the array in place, then pretend it's a 1D array by pointing to...
  5. So you want to flatten 1 2 3 4 5 6 7 8 9 ...

    So you want to flatten
    1 2 3
    4 5 6
    7 8 9

    into
    1 2 3 6 5 4 7 8 9
    ?
  6. Replies
    2
    Views
    141

    If it frees all the memory you allocated during a...

    If it frees all the memory you allocated during a normal exit, that should be fine.

    Freeing all the memory in various exception cases is rather more involved.
  7. Which compiler are you using?

    Which compiler are you using?
  8. Replies
    4
    Views
    135

    Try compiling with some warnings. $ gcc...

    Try compiling with some warnings.


    $ gcc -Wall main.c
    main.c:2:6: warning: return type of ‘main’ is not ‘int’ [-Wmain]
    void main()
    ^
    main.c: In function ‘main’:
    main.c:6:16: warning:...
  9. Replies
    1
    Views
    128

    > display(choice); C doesn't do pass by...

    > display(choice);
    C doesn't do pass by reference.

    > void display(int choice)
    You have a return choice at the end.
    This won't even compile without a warning.



    int display(void){
  10. Replies
    6
    Views
    430

    Well I found BenSmith's alter ego posts: buffer...

    Well I found BenSmith's alter ego posts:
    buffer overflow
    Vulnerability in c functions
    The pastebin.com link to actual source code has long since expired.
    On the off-chance that the image...
  11. > Linux kernel wants to using Rust. References!

    > Linux kernel wants to using Rust.
    References!
  12. Replies
    10
    Views
    353

    Can you declare an array? Can you print a...

    Can you declare an array?

    Can you print a prompt?

    Can you input an integer?

    In short, show us how far you can get by yourself.
  13. Are you back again? Is Rust-Lang a replacement...

    Are you back again?
    Is Rust-Lang a replacement for C or C++?
  14. Replies
    1
    Views
    165

    You start with some research. Shortest path...

    You start with some research.
    Shortest path problem - Wikipedia

    Then you decide on a data structure to represent " The adjacency list for the graph."
  15. Replies
    3
    Views
    170

    for(i=2 ; i

    for(i=2 ; i <= low /2 ; ++i ){
    if(low % i==0) //!! what happened to these braces?
    isPrime=0;
    break;
    }
  16. Making strings constant was something added way...

    Making strings constant was something added way back in C90.
    Back then, there was still a lot of code which didn't use const properly, so you didn't get a warning.

    So as a special case, you don't...
  17. Replies
    5
    Views
    220

    You need to return the new value of the counter.

    You need to return the new value of the counter.
  18. Thread: Array help

    by Salem
    Replies
    5
    Views
    406

    On the assumption that @jazzamate just posted in...

    On the assumption that @jazzamate just posted in the wrong forum, a C answer.

    A bit of advice.
    If you have arrays, you should be looking at loops (not copy/pasting specific subscripts).
    ...
  19. Replies
    1
    Views
    509

    Linux is an operating system, not a language. ...

    Linux is an operating system, not a language.

    If you just stick to the standard libraries of C and C++, then there is no difference at all between writing a Windows program and writing a Linux...
  20. Replies
    3
    Views
    231

    >...

    > numberOfWordsInDict(array[MAXWORDS][MAXLENGTH]);
    You don't specify the size of the array when you call the function.

    It's only
    numberOfWordsInDict(array);
  21. Replies
    6
    Views
    430

    Look along the top ribbon. New Posts Private...

    Look along the top ribbon.

    New Posts
    Private Messages
    C and C++ FAQ
    Community
    Forum Actions
    Quick Links
  22. Replies
    6
    Views
    430

    You have a limited grace period of a few hours to...

    You have a limited grace period of a few hours to edit.

    But since you have only one post, what did you have in mind.

    If you have an old account, and you want to remove some specific thing from...
  23. Replies
    14
    Views
    578

    Not sure what compiler you're using, or where...

    Not sure what compiler you're using, or where "invalid operands to binary + (have 'float' and 'float *')|" came from.

    But the code you posted compiles and runs.


    $ gcc -Wall main.c
    main.c: In...
  24. Also here -> Use a linked list queue to simulate...

    Also here -> Use a linked list queue to simulate cust - C++ Forum
  25. Replies
    2
    Views
    207

    I deleted all your other posts, hijacking other...

    I deleted all your other posts, hijacking other threads.

    "I cannot solve the problem with this output since I already tried many times"
    So post one of your better attempts, and then we'll help...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4