Search:

Type: Posts; User: rmmstn

Page 1 of 3 1 2 3

Search: Search took 0.02 seconds.

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

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

    #include #include #include...

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


    #define MAX 3000


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

    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.

    ...
  5. Replies
    8
    Views
    356

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

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

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

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

    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...
  8. Replies
    8
    Views
    356

    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{
  9. Replies
    1
    Views
    341

    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));
  10. Replies
    3
    Views
    398

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

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

    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...
  12. 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?
  13. 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)
    {
    ...
  14. Replies
    1
    Views
    331

    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...
  15. Replies
    1
    Views
    470

    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.

    ...
  16. Replies
    2
    Views
    440

    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...
  17. Replies
    2
    Views
    440

    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,...
  18. 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?...
  19. 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...
  20. I'm kind of a newbie in C and I haven't learned...

    I'm kind of a newbie in C and I haven't learned about setlocale yet
  21. Okay I have no more warnings: #include...

    Okay I have no more warnings:


    #include <stdio.h>
    #include <string.h>
    #include <ctype.h>
    #include <stdlib.h>
    #define MAX 100
    unsigned checkWord(char *word)
    {
  22. Haha, that's actually what I wanted to do so I...

    Haha, that's actually what I wanted to do so I would spare myself of all the work but I thought I'd solve it the way it was stated first
  23. Maximum of the real numbers found into the input

    Write a function that reads data from standard input until EOF is found and returns the maximum of the real numbers found into the input.
    We consider a real number as a number composed of two...
  24. Function not splitting words from dynamically allocated array correctly

    I want to write a function that splits a string into words (strings with no whitespace), returning a (dynamically allocated) array of pointers to (dynamically allocated) copies of the words in the...
  25. Replies
    7
    Views
    614

    Thanks a lot, it's so much clearer now! Just to...

    Thanks a lot, it's so much clearer now! Just to make sure I understood fully, you wrote i < cap - 1 because we don't take the terminator '\0' into a account, right?
Results 1 to 25 of 60
Page 1 of 3 1 2 3