I am writing a code in c++ unix environment using gmp for impelementing quadratic sieve
I have many global variables i.e the number to be factorised and some arrays, sievelength,factorbase siz etc. During the first part of the program, the program simply calculates the factor base implemented through a fucntion compute factor base(), which currently is in my main() program. I want to move the function definition to another file and only call the function in main() , is there any way other than explicitly passing all the variables to the function???
abhishek4563
0
Newbie Poster
Recommended Answers
Jump to PostSounds like you should create a struct to contain all the globals and simply pass the address of the struct variable. If the struct definition is in a header file included where need be you would be able to use it that way. Globals can always be eliminated. Something to …
All 2 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.