Hi
I wanted to know if you can describe how next record, first record, previous record and last record work if i want to navigate in the array.
thanks
Hi
I wanted to know if you can describe how next record, first record, previous record and last record work if i want to navigate in the array.
thanks
Kendals
This is a very vague question.
Record array[SOMESIZE];
Record *first, *current, *next, *prev;
first = array[0];
current = array[CURRENT];
prev = CURRENT < 1 ? 0 : CURRENT -1;
next = CURRENT < SOMESIZE -1 ? CURRENT + 1 : SOMESIZE -1;
That should do the trick.
Additionally, you could use pointer math to handle this instead of using a counter. Subtract pointer1 from pointer2 and compare the numerical difference.
Quzah.
Hope is the first step on the road to disappointment.
thanks, is there a standard for pseudocode? or can you describe it as structured english?
Kendals
What do you mean? Generally speaking, you can just form it as english. However, there is nothing pseudocode about that. Define a constant (or #define) to hold your array size. Declare a variable called 'CURRENT', and apply it to the above. typedef your data type to 'Record', and there you have 100% working C code.
Anyway, pseudocode is usually done in standard english:
Pesudocode is meant to be "understandable to the non programmer", or perhaps "a guideline for the programmer". It's good to think of pseudocode as an outline for a report.Code:if mybills > myincome output "You'll go broke soon." else if mybills == myincome output "You'll never get out of debt." else output "You'll be out of debt soon."
You can simplify your pseudocode as much as you need, or make it as complex as you desire.
One way to build your project overview is to make very simple pseudocode to outline it, then break each step down into more and more complex results until you end up with the final product. Shrug.
Quzah.
Hope is the first step on the road to disappointment.