Search:

Type: Posts; User: rmmstn

Page 1 of 3 1 2 3

Search: Search took 0.02 seconds.

  1. You're right, my lcp() function was the issue,...

    You're right, my lcp() function was the issue, it's working perfectly now, thanks a lot!
  2. I've tried doing char *result = NULL;...

    I've tried doing


    char *result = NULL;
    result = (char *)malloc(sizeof(char) * 100);




    But I'm still facing the same issue when debugging :/
  3. Yes this works, but does this till use divide and...

    Yes this works, but does this till use divide and conquer? I'm just learning this method and I can't always recognize it
  4. Longest common prefix divide and conquer - seg fault

    I'm trying to write a program that prints the longest common prefix, using divide and conquer, but I'm getting a seg fault and I'm not certain why. I'm guessing it has something to do with the result...
  5. Replies
    2
    Views
    577

    I've updated the code: #include ...

    I've updated the code:


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


    #define MAX 1000
    #define HEIGHT 24
  6. Replies
    2
    Views
    577

    Solve maze backtracking

    I'm trying to solve a maze from 'S' to 'E', then printing the solution with a '.' in each cell from the path. The maze is:

    ...
  7. How to count number of digits of printf argument?

    So, I know the question sounds strange but I don't really know how to phrase it better. I'll try to explain: I'm writing my own version of printf, this is the code I have so far:


    #include...
  8. Replies
    2
    Views
    526

    qsort not working on array of structs

    I'm trying to sort data from a .csv file based on the year (3rd field), using qsort and bubble sort to test the speed of both:


    Look What The Cat Dragged In,Poison,2001,Look What The Cat Dragged...
  9. Replies
    4
    Views
    600

    #include #include #include...

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


    #define MAX 3000


    typedef struct{
    char name[100];
  10. Replies
    4
    Views
    600

    Create tar-like archiver

    I want to write a simple version of tar, that is able to archive files provided as command line arguments (no compression needed). I've just started learning about binary files so I'm a bit lost.

    ...
  11. Replies
    8
    Views
    450

    Nevermind, I didn't see he defined each function...

    Nevermind, I didn't see he defined each function after main :/
  12. Replies
    8
    Views
    450

    I see, I've never encountered them before, that's...

    I see, I've never encountered them before, that's why
  13. Replies
    8
    Views
    450

    Could you please explain this part? I don't...

    Could you please explain this part? I don't usually use global variables, why did we declare them globally and not in main. Also, would it be possible to use a struct until entry, then use another...
  14. Replies
    8
    Views
    450

    Printing readable data from ELF file

    I want to print the file, program and section headers from an ELF file, but I'm getting some weird results.



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


    typedef struct{
  15. Replies
    1
    Views
    617

    Issue with typecasting float to int

    #include <stdio.h>


    int main()
    {
    int i = 0;
    for(i = 0; i <= 10; i++)
    {
    float offset = (i/1000)*256;
    printf("%d\n", (int)(offset));
  16. Replies
    3
    Views
    625

    So should I initialize with strlen(word)+1 *...

    So should I initialize with strlen(word)+1 * sizeof(char)?
  17. Replies
    3
    Views
    625

    Why do I get segmentation fault

    I need to parse data from a csv file but for some reason I'm getting a segmentation fault error. I have exactly 5 comma separated fields on each line so I wanted to use an array of pointers to hold...
  18. Okay, so if I declare c as an int could implement...

    Okay, so if I declare c as an int could implement the same logic and just typecast c to char?
  19. Count number of occurrences of each character in input

    I want to count the number of occurrences of each character found in the input and print it to the output.


    #include <stdio.h>
    #include <string.h>
    int main(int argc, char **argv)
    {
    ...
  20. Replies
    1
    Views
    415

    How to go back from switch menu

    I want to make a menu that classifies animals into insects, birds, mammals and fishes with specific characteristics for each of these (using composite variables). I thought I'd use a nested switch...
  21. Replies
    1
    Views
    730

    Print sorted lines from file

    I have the following .txt file:
    1 7 9 12
    8 4 22 5
    4 9 0 10
    15 2 3 14
    I wanna print the lines in descending order based on the average value on each individual line.

    ...
  22. Replies
    2
    Views
    620

    Thank you! If I wanna work with dynamically...

    Thank you! If I wanna work with dynamically allocated arrays is this the way to go?


    #include <stdio.h>
    #include <string.h>
    #include <stdlib.h>
    #include <ctype.h>
    #define MAX 100
    unsigned...
  23. Replies
    2
    Views
    620

    Copying prime numbers into array

    I'm trying to implement a function that receives an array of integers and its capacity and fills the array with all the values read from the keyboard which are prime numbers, without overflowing it,...
  24. Thanks, now I'm trying to get the maximum hour...

    Thanks, now I'm trying to get the maximum hour from the file and if two hours are equal then check their minutes to sort them in descending order. Would it be easier to use a structure in this case?...
  25. free(): double free detected in tcache 2 Aborted (core dumped)

    I want to implement a program that reads data from a file specified as a command-line argument, having the following format:
    username, hh, mm
    where the fields are separated by a comma and might...
Results 1 to 25 of 66
Page 1 of 3 1 2 3