C/C++

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • Global Array with size for input

    1 answers - 574 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    Hallo, i have to do a program with gsl library. I have to declare two
    global array cos i can't pass them to gsl functions. The problem is the
    size is an input from program. What can i do? I want to try it:
    /* Declaration global variables */ int elementi ; gsl_vector_complex
    *s_v= gsl_vector_complex_alloc (elementi) ; double esponenti [elementi]
    ; int main () { scanf ("%d", &elementi) ;
    /* inizializzation esponenti */ /* gsl function with the
    inizialization of s_v inside a for () */ return 0 ; }
    What can i do? By Aleramo.
  • No.1 | | 1268 bytes | |

    Aleramo wrote:

    Hallo, i have to do a program with gsl library. I have to declare two
    global array cos i can't pass them to gsl functions. The problem is
    the size is an input from program. What can i do? I want to try it:
    /* Declaration global variables */ int elementi ;
    gsl_vector_complex *s_v= gsl_vector_complex_alloc (elementi) ; double
    esponenti [elementi]
    ; int main () { scanf ("%d", &elementi) ;
    /* inizializzation esponenti */ /* gsl function with the
    inizialization of s_v inside a for () */ return 0 ; }
    What can i do? By Aleramo.

    Before anyone will even try to read your code, please format it and
    indent properly. Please also note that `` is not a valid C syntax
    construct. Ideal is a properly indented complete example that can be
    cut, pasted, and compiled (ideally with no errors).

    Also, `gsl` library (whatever that is) is not part of Standard C and
    hence not topical here. This means that nobody here will even try to
    figure out whether you problem lies in that library, let alone what it
    might be. Try to make your example and question independent of the
    `gsl` library.

    As a hint, you can try dynamically allocating the memory you require.

    Cheers

    Vladimir

Re: Global Array with size for input


max 4000 letters.
Your nickname that display:
In order to stop the spam: 2 + 1 =
QUESTION ON "C/C++"

EMSDN.COM