Search:

Type: Posts; User: dpitz

Search: Search took 0.01 seconds.

  1. Thank you guys, that's exactly what I need!

    Thank you guys, that's exactly what I need!
  2. I did. Here it's: #include void...

    I did. Here it's:


    #include <stdio.h>

    void foo(int **vec)
    {
    int n = 3;
    vec = malloc(n*sizeof(int*));
    *vec[0] = 41;
  3. Oops, my bad. But it's not working yet =P....

    Oops, my bad.
    But it's not working yet =P. Actually the black screen closes just after it opens. You think the code is wrong or it's a problem with the compiler?
  4. Thank you claudiu, but I think I didn't get it......

    Thank you claudiu, but I think I didn't get it... I tried this:


    #include <stdio.h>

    void foo(int **vec)
    {
    int n = 3;
    vec = malloc(n*sizeof(int**));
    *vec[0] = 41;
  5. Problem in declaring array size inside a function

    I'm passing an array (pointer) as an argument of a function, but I know the size of the array only inside the function, so I'd need something like this:


    #include <stdio.h>

    void foo(int *vec)...
  6. Replies
    5
    Views
    918

    It works here, I typed this into main: ...

    It works here, I typed this into main:



    char a = enterSectionLetter();
    printf("\nChar is: %c", a);

    If I execute the program and type A it gives "Char is A".
  7. Replies
    5
    Views
    918

    Your function must return an int, and you return...

    Your function must return an int, and you return a char.

    The "Enter section [A-Y]" is printed not only twice, but as many characters you type plus one (the '\n' character), so it means that each...
  8. Replies
    5
    Views
    918

    Attention, you're using the "=" sign to compare...

    Attention, you're using the "=" sign to compare two chars, and using "%d" in the scanf.
  9. Replies
    4
    Views
    1,395

    Ok, with what I've written until now I can be...

    Ok, with what I've written until now I can be sure I won't access an uninitialized 'a'. In fact I count the number of elements inserted in each second index to avoid this.

    Thank's again.
  10. I think you didn't check your while loop after...

    I think you didn't check your while loop after seeing the printed value of i ^^.
    If you choose to convert 10 to base 2 (1010), you'll get i=4, since 1010 has 4 digits. What we're trying to say is...
  11. Add this line above your last while loop and...

    Add this line above your last while loop and check what it gives:


    printf("\ni = %d\n", i);

    Now check again your while loop and voila
  12. Replies
    4
    Views
    1,395

    Thank you, it's really better this way, using...

    Thank you, it's really better this way, using another array.
    And should I initialize the parameters ('a' in this case) before I start to attribute values? Even if I use realloc there will be some...
  13. Replies
    4
    Views
    1,395

    Question on matrix initialization

    Good morning everybody!
    I'm working on an application where I have a structure and I'll use its parameters in a bidimensional matrix [n][k], where n is known and k is unknown and might be different...
Results 1 to 13 of 13