change the address of one element of int table?

D

dopiotrko

Is it possible to change the address of one element of int table?
My program would be much simpler, if the first element of the table
would be same as last one. I mean:
int *s;
s=(*int)malloc(sizeof(int)*10);
…..
and no mater what I would do to this table I want s[0]==s[9] to be
true.
How to do this?

dopiotrko
 
B

Ben Bacarisse

Thanks.
Very helpful
Especially last option.

I may also be worth considering a circular linked list. Once set up,
you can repeat:

use(list_ptr->value);
list_ptr = list_ptr->next;

as often as you like, cycling round the values.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,128
Latest member
ElwoodPhil
Top