Search:

Type: Posts; User: rmmstn

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. 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?
  2. 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)
    {
    ...
  3. Replies
    1
    Views
    135

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

    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.

    ...
  5. Replies
    2
    Views
    297

    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...
  6. Replies
    2
    Views
    297

    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,...
  7. 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?...
  8. 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...
  9. 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
  10. 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)
    {
  11. 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
  12. 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...
  13. 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...
  14. Replies
    7
    Views
    509

    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?
  15. Replies
    7
    Views
    509

    Damn, yeah I treated it as an array of characters...

    Damn, yeah I treated it as an array of characters by mistake and I wanted to make sure that it is empty and null-terminated in the beginning. What would be the alternative to make sure my array isn't...
  16. Replies
    7
    Views
    509

    Is this correct? #include ...

    Is this correct?


    #include <stdio.h>
    #include <string.h>
    #include <stdlib.h>
    void wordAdresses(char *s, int *ptr_arr, int cap)
    {
    ptr_arr[0] = '\0';
    unsigned i, countWords = 0;
  17. Maximum of the real numbers found into the input, no strings

    The task is:
    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...
  18. Replies
    7
    Views
    509

    Array of pointers with addresses of words

    Task: Write a function that takes as parameter a string, an array of pointers and its length and fills the array with addresses to the beginning of each (whitespace-separated) word in the string...
  19. Thread: Reorder argv

    by rmmstn
    Replies
    2
    Views
    258

    Thanks! :D #include #include...

    Thanks! :D


    #include <stdio.h>
    #include <string.h>
    #include <stdlib.h>
    int main(int argc, char* argv[])
    {
    char* aux;
    printf("Program name is %s\n", argv[0]);
  20. Thread: Reorder argv

    by rmmstn
    Replies
    2
    Views
    258

    Reorder argv

    I have the following task:
    Write a program that reorders the command-line argument array argv[], placing all strings that start with '-' first, followed by all other strings.



    #include...
  21. Replies
    3
    Views
    414

    Thanks a lot! I copy-pasted the task so I don't...

    Thanks a lot! I copy-pasted the task so I don't think I should add a space. I'll keeps the little things in mind for future code :D
  22. Replies
    3
    Views
    414

    How to prevent array overflow

    I did the task:
    Implement a function that receives a C-styled string (s) and an array of characters (buff) together with its capacity and concatenates into buff all the words from s which are...
  23. Replies
    8
    Views
    616

    It's working now, thank you!

    It's working now, thank you!
  24. Replies
    8
    Views
    616

    #include #include #include...

    #include <stdio.h>
    #include <ctype.h>
    #include <string.h>
    #define MAX 100
    int checkWord(char word[])
    {
    size_t len = strlen(word);
    if(word[0] != '&' || word[len-1] != ';')
    ...
  25. Replies
    8
    Views
    616

    Yeah, I added that afterwards because I didn't...

    Yeah, I added that afterwards because I didn't know what else to try, but it doesn't work without it either.
Results 1 to 25 of 49
Page 1 of 2 1 2