In programming, a dynamic variable is a variable whose address is determined when the program is run. In contrast, a static variable has memory reserved for it at compilation time.
Questions tagged [dynamic-variables]
262 questions
4
votes
3 answers
In C++, is the length information of a dynamic array associated with the pointer or the address of the first element?
For example:
int *a, *b;
a = new int[10];
b = new int(12);
b = a; // I know there's memory leak, but let's ignore it first
delete [] b; // line L
What will happen? Will the entire array be deleted successfully?
What if line L is replaced by this:
…

Shen Zhuoran
- 385
- 3
- 13
4
votes
1 answer
Why does dynamic binding affect the body of future?
I'm trying to reproduce pitfalls of dynamic vars described by Chas - http://cemerick.com/2009/11/03/be-mindful-of-clojures-binding/.
Consider the following snippet:
(def ^:dynamic *dynamic-x* 10)
(defn adder [arg]
(+ *dynamic-x* arg))
(adder 5)…

OlegTheCat
- 4,443
- 16
- 24
4
votes
3 answers
PHP take string and check if that string exists as a variable
I have an interesting situation. I am using a form that is included on multiple pages (for simplicity and to reduce duplication) and this form in some areas is populated with values from a DB. However, not all of these values will always be…

klye_g
- 1,242
- 6
- 31
- 54
4
votes
1 answer
passing dynamic variable to partial for rendering in a modal
I have the following Code on a partial that dynamically generates a list of associated steps to a pin. Both pins and steps have image(s). Users are able to add multiple steps to a pin and then this view dynamically generates a view of these steps.…

user3313516
- 57
- 7
3
votes
2 answers
Dynamic Variable Names iOS
Possible Duplicate:
create multiple variables based on an int count
Objective C Equivalent of PHP's “Variable Variables”
I'd like to use some dynamic variable names in a for loop and am stumped as to how to actually reference the variables.
I…

Peter Kazazes
- 3,600
- 7
- 31
- 60
3
votes
1 answer
How to set Postman dynamic variable and use value in the same request?
I need to use the same value into two different elements/attributes on the one XML request body. I tried to add it as a collectionVariable and recall it from there but Postman generates two different values for them.
For example, I am trying to…

aurora.borealis
- 33
- 1
- 3
3
votes
1 answer
Ansible - dynamic variable with host_vars and string in the name
I'm trying to create a job role in Ansible to run yum install/update of packages, which will be provided by a 3rd party system as a .yml file to vars directory in a role with following convention: server01.yml, server02.yml, serverX.yml with…

PawelN
- 33
- 1
- 4
3
votes
1 answer
How to convey current thread's bindings to another thread?
How to convey all of the current thread's bindings to another thread? To be specific, I need the following snippet to print 2 (not 1) to stdout:
(defvar *foo* 1)
(let ((*foo* 2))
(bordeaux-threads:make-thread (lambda () (print *foo*)))) ;; prints…

OlegTheCat
- 4,443
- 16
- 24
3
votes
2 answers
Using column names from dynamically named variables in Coldfusion
I want to create a function that will loop through an arbitrary query and perform an insert into another table based on the arbitrary column names.
For instance, the idea here would be to output
(data, data, data...)
(data, data,…

abalter
- 9,663
- 17
- 90
- 145
3
votes
4 answers
How to convert array values to variables
I have value an array like this:
multi_arr = ["resi_spec","resi_desc"];
So each array value is considered as a variable and I want to store some value of these variables dynamically like this:
resi_spec = "good morning"
resi_desc = "good…

SSN
- 846
- 2
- 7
- 20
3
votes
2 answers
How to define dynamic variable and assign it to some value in rails
I want to create dynamic variable and assign values to them. Here is quick sample what I tried so far.
array = %w(this is a test)
array.each_with_index do |c,v|
puts "variable_#{v}".to_sym
end
which gives me output like this:
# variable_0
#…

Hetal Khunti
- 787
- 1
- 9
- 23
3
votes
2 answers
Convert list of strings into objects
I have a list of strings, say something like:
listofstuff = ['string1', 'string2', 'string3', ...]
I have a created a custom class object for what I want to do. All I want now is to create a bunch of said objects that are named the strings in my…

Captain_Panda
- 33
- 1
- 1
- 4
3
votes
2 answers
Dynamic variable names in Smarty
I want to be access some variables I've assigned dynamically from PHP in Smarty, here is an example:
$content_name =…

Ben Everard
- 13,652
- 14
- 67
- 96
3
votes
2 answers
Elegant Solution For Storing XML Data
i have got my application to read in some values from my xml document however i am unsure of how I'm going to store them as i have in total 6 pieces of information for each element in the file at the moment.
XML Example

crackruckles
- 336
- 2
- 5
- 21
3
votes
4 answers
Dynamically add variables in C++
I'm working on a project for school. This is the case:
You should be able to input weights for n number of students. Calculate average weight of students and output how many students are weighting less than 65 kg's.
By now I have this sample of…
user1386320