Search:

Type: Posts; User: G4143

Page 1 of 5 1 2 3 4

Search: Search took 0.01 seconds.

  1. Pro tip.. printf("Socket creation...

    Pro tip..


    printf("Socket creation failed\n");

    If the socket failed.. You probably want to exit the program.


    fputs("Socket creation failed\n", stderr);
    exit(1);
  2. Replies
    3
    Views
    2,825

    Another good resource is Douglas Comer books ...

    Another good resource is Douglas Comer books

    Douglas Comer - Wikipedia

    https://www.cs.purdue.edu/homes/comer/comerbooks.html
  3. Replies
    18
    Views
    4,188

    Pro tip! Post your code with the provided tags....

    Pro tip! Post your code with the provided tags.
    Next pro tip.. State, clearly, how the data is stored. I assume you are working with ascii text data... Am I right?
  4. Replies
    4
    Views
    1,544

    I basically want to check if allocated memory has...

    I basically want to check if allocated memory has a proper(initialized) value. I want to check if the allocated memory was initialized.
  5. Replies
    4
    Views
    1,544

    Valid, Initialized Allocated Memory

    What is a good way to ensure that allocated memory is initialized to a value? I know one can follow strict coding practices but I'm wondering how one can ensure allocated memory is properly...
  6. Your link(attachment) doesn't work.

    Your link(attachment) doesn't work.
  7. Thread: delete function

    by G4143
    Replies
    42
    Views
    11,860

    There isn't a mistake in your diagram. There is a...

    There isn't a mistake in your diagram. There is a shortcoming in your understanding of C's call by value mechanism.

    Understand how C passes values to functions and you'll see what you have to do.
  8. Thread: delete function

    by G4143
    Replies
    42
    Views
    11,860

    This whole delete function can be solved and...

    This whole delete function can be solved and understood if you understand that C is a call by value language.
    If you understand what call by value is and what a pointer variable is(hint - A pointer...
  9. Thread: delete function

    by G4143
    Replies
    42
    Views
    11,860

    Shouldn't delete have a way to access the new...

    Shouldn't delete have a way to access the new head?
  10. Thread: reverse string

    by G4143
    Replies
    11
    Views
    4,023

    Yeah, you are right. This doesn't work! ...

    Yeah, you are right. This doesn't work!


    #include <stdio.h>
    #include <string.h>

    int main(int argc, char ** argv) {
    char test_str[] = "G4143's test string";
    char * bgn_str = test_str;
    ...
  11. Thread: reverse string

    by G4143
    Replies
    11
    Views
    4,023

    [QUOTE=Vithika;1307660] #include ...

    [QUOTE=Vithika;1307660]
    #include <stdio.h>

    int main()
    {
    int i = 0;
    char array[6]= {"NEERG"};
    char temp = array[0];

    for ( int i = 0; i < 6; i++)
  12. Thread: reverse string

    by G4143
    Replies
    11
    Views
    4,023

    You should also consider the case where the...

    You should also consider the case where the swapped characters are identical.
  13. Replies
    13
    Views
    5,571

    What does this code do? if (argc != 2) {...

    What does this code do?

    if (argc != 2)
    {
    printf("Usage: ./a4 %s\n", file_name);
    return1;
    }

    First you check if the argument counter is not equal to 2 and then use the second argument....
  14. Replies
    6
    Views
    1,942

    Well Salem presented the easiest way but you...

    Well Salem presented the easiest way but you could also used pointer arithmetic to access the allocated memory.
  15. Replies
    3
    Views
    1,756

    You pass a pointer to a pointer because you need...

    You pass a pointer to a pointer because you need to pass the original variable address which is a pointer... Clear as mud right?

    It all comes down to what is passed to the function "copied" and...
  16. Replies
    3
    Views
    1,756

    Yes that is correct.. If you need to change the...

    Yes that is correct.. If you need to change the value of the pointer variable(via a function call), then you pass the address of the variable pointer.
  17. Replies
    8
    Views
    2,344

    You can't... Memory is not type-identifiable....

    You can't... Memory is not type-identifiable. Memory is memory. You either create a memory pointer that's typed to the type you want or you create some sort of scheme for that's used to identify a...
  18. Replies
    8
    Views
    2,344

    Do you really need the if statement here? You are...

    Do you really need the if statement here? You are taking the sizeof a void pointer.
  19. Thread: inserting nodes

    by G4143
    Replies
    2
    Views
    1,628

    Well first you have to find a way to walk down a...

    Well first you have to find a way to walk down a list that contains nodes.
    Second, you have to find a way to compare the values of the nodes with the value to insert.
  20. Thread: Puzzle

    by G4143
    Replies
    9
    Views
    1,682

    If I try it, it'll be a brute force solution.

    If I try it, it'll be a brute force solution.
  21. Thread: Puzzle

    by G4143
    Replies
    9
    Views
    1,682

    Jane Street! That's those OCaml boys! You can bet...

    Jane Street! That's those OCaml boys! You can bet the puzzle is tricky.
  22. Thread: Puzzle

    by G4143
    Replies
    9
    Views
    1,682

    Just to verify the puzzle. We start in the lower...

    Just to verify the puzzle. We start in the lower left corner at 0 and then we(for example) move to the square above which would could be: The running total of 0 plus the dice face value of 5 multi by...
  23. Replies
    1
    Views
    1,701

    C header files vs C++ header files

    Is there a big difference between C header files vs C++ header files? I ask because VS Code sets, by default, my C header files to C++ header files.

    Basically does either header file offer any...
  24. Replies
    3
    Views
    1,600

    So basically the compiler knows how big the...

    So basically the compiler knows how big the pointer's data type is...
  25. Replies
    3
    Views
    1,600

    sizeof deferenced NULL pointer

    I'm just wondering if this is a safe practice.



    #include <stdio.h>

    int main(int argc, char ** argv) {
    int * i_ptr = NULL;
    fprintf(stdout, "size: %lld\n", sizeof(*i_ptr));//How safe is...
Results 1 to 25 of 104
Page 1 of 5 1 2 3 4