473,378 Members | 1,482 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Global Array with size for input

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.

Jan 29 '06 #1
1 1834
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

--
If you think education is expensive, try ignorance.
-- Derek Bok, president of Harvard

Jan 29 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Larry L | last post by:
I have a Module that declares several arrays as public, some string, some integers. I then have 2 forms. Form A is the main form, that loads on start-up, and has a command button to open Form B. On...
1
by: Nimmi Srivastav | last post by:
There's a rather nondescript book called "Using Borland C++" by Lee and Mark Atkinson (Que Corporation) which presents an excellent discussion of overloaded new and delete operators. In fact there...
8
by: john townsley | last post by:
whats the best way to declare Global objects (holding say 10 member variables and functions) of an unknown size in c++, memory efficient as possible thanks
6
by: Soha | last post by:
I'm a beginner in using javascript and i need a reply so urgent; i have a problem in using javascript with asp the problem is that i want to define a global variable and then change the value of it...
17
by: Davor | last post by:
How to define global variable in main()? I'm asking because I have an array in main, whose size is determined by input, so the definition has to be in main ( or in some other funcion ). And I need...
7
by: arkobose | last post by:
hey everyone! i have this little problem. consider the following declaration: char *array = {"wilson", "string of any size", "etc", "input"}; this is a common data structure used to store...
4
by: Bilgehan.Balban | last post by:
Hi, The following code: #include <stdio.h> // const int const_asize = 10; #define define_asize = 10; int array = {1,2,3,4,5,6,7,8,9,0};
23
by: sandy | last post by:
I need (okay, I want) to make a dynamic array of my class 'Directory', within my class Directory (Can you already smell disaster?) Each Directory can have subdirectories so I thought to put these...
13
by: dmj07 | last post by:
Hi all, I have a simple table set up in which a user can insert values into the boxes and onkeydown it will sum up the column. Table: <table> <tr> <td><input type="text"...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.