May seem like a stupid question but can an array call a function? and if so is it possible to select an array from user input, so if the array was something like Num[10] and the user would input 6, it would then select Num[5] and call the function associated with that subscript.

Recommended Answers

All 7 Replies

No. An array is a list of values. Values can't call functions. Only code can call functions.

So I guess it was a stupid a question, thanks anyway.

Technically speaking, the only difference between code and data are memory attributes. So an array could carry values that equate to a function calls but you could not call them unless you changed the memory attributes to read/execute and pointed the instruction pointer at them..

Technically speaking, the only difference between code and data are memory attributes. So an array could carry values that equate to a function calls but you could not call them unless you changed the memory attributes to read/execute and pointed the instruction pointer at them..

:icon_rolleyes:

:icon_rolleyes:

So your stating that memory attributes can't be changed? Are you sure about your 'rolling eyes' and what it implies.

I know what I meant to imply, and it has nothing to do with memory attributes. I see I should have quoted the entire statement. So corrected.

I know what I meant to imply

and what was that?

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.