Search:

Type: Posts; User: petz_e

Search: Search took 0.00 seconds.

  1. Replies
    5
    Views
    2,008

    Ok I see. Thank you. The aim of the exercise is...

    Ok I see. Thank you. The aim of the exercise is to implement some other features and functions and then to optimize these to the max (memory wise and runtime wise). That's why I was so concerned...
  2. Replies
    5
    Views
    2,008

    fgets with pointers?

    Hi,

    I'm trying to learn C, and part of an exercise is to read what the user types in and print it in the console character-by-character.



    #include <string.h>
    #include <stdlib.h>
    #include...
  3. Replies
    6
    Views
    2,190

    Isolating the digits of an integer

    Well, I am a bit stuck here. Here is what I want to do.

    I have an integer 'n' and I want to isolate every single digit and put them into an array of ints.

    Example: n = 1024
    t[0] = 4
    t[1] = 2...
  4. Replies
    6
    Views
    2,190

    In fact, it is a dynamic sized array with integer...

    In fact, it is a dynamic sized array with integer values between 0 and 9. I just put constant values here for the post. I think '0'+c[i] should work for my example, I still need to test it.

    Patrick
  5. Replies
    6
    Views
    2,190

    convert int to char without a bus error

    Hi,

    I want to convert an integer to a char:

    (...)
    char *converttostr( my_struct a )
    {
    char *c;
    c = (char *)malloc(20 * sizeof(char));
  6. No, it's ok. I got it working now :) Thanks again...

    No, it's ok. I got it working now :) Thanks again

    Patrick
  7. OK, the input string doesn't have to be composed...

    OK, the input string doesn't have to be composed of consecutive digits, but this should not matter.

    Thanks for the replies and for the help.

    Patrick
  8. But what does the -'0' mean? Is this used to make...

    But what does the -'0' mean? Is this used to make the conversion?
    And just to get things right, if the string is entered with a scanf command, you also have to remove the \n character at the end,...
  9. Here is my code: #include ...

    Here is my code:


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

    typedef struct {
    int signe;
    int size;
  10. Converting single characters of a string into integers

    Hello,

    This is my first post in this forum.

    I have a string s in the following format: -1234567890

    Now I need to strip the '-' and convert every single digit into an int and place it into an...
Results 1 to 10 of 10