Sign in to follow this  
Followers 0
longisland

pointers, stacks and queues anyone know.....?

2 posts in this topic

Has anyone used pointers, stacks or queues in autoit? what is the syntax of such data structures?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Has anyone used pointers, stacks or queues in autoit? what is the syntax of such data structures?

I'm sorry, but asking about "pointers" is a bit vague. What are you trying to use them for ? Mind you, a "pointer" can actually be just that : a simple reminder where to look to next, like an index into another table.

As for stacks and queues ? Neither seem to be nativily available in AI (as a quick look revealed). That means you will probably need to make your own.

For a stack that can be as simple as to define an array, and a pointer to the first-free array-element (a stack is a first-in, last-out mechanism). When you put something on the stack you place that data into the first-free array-element, and advance the pointer. When removing you decrement the pointer, and return the value from the array-element its pointing at.

For a queue it can be as simple as creating something like the above, but removing the data from the bottom (a queue is a first-in, first-out mechanism). Ofcourse, when you remove from the bottom you need to move all array-elements above it (and the pointer) one place down.

Hope that helps.

Edited by BitRot

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0