|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#7
|
||||
|
||||
|
Re: How to manipulate a variable value using an array?
int *ptr;
int a, b; a = 10; ptr = &a; b = *ptr; Why bother with the int *ptr declaration when it has to be used again in the b= part? Is this just proper etiquette and not really needed? Is this alright for my declaration: int joystickbuttons[8] = {&p1_sw_trig, &p1_sw_top, &pl_sw_aux1, &p1_sw_aux2, &p2_sw_trig, &p2_sw_top, &p2_sw_aux1, &p2_sw_aux2}; And this for my looped search: if ((*)joystickbuttons[arrayindexer[1]] == 1) arrayindexer is just a simple array I am using for a counter. If all this looks good then it means I finally figured this whole pointer thingie out largely thanks to this forum and Wiki. Last edited by amateurrobotguy : 13-12-2007 at 01:50. |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| turning inputs into outputs | Huron Warriors | Programming | 4 | 19-04-2007 22:10 |
| How do the Analog Inputs work? | JBotAlan | Electrical | 3 | 07-01-2005 00:11 |
| How to put Inventor pics on the web | Andrew Schuetze | Inventor | 7 | 05-01-2005 13:59 |
| How much time do you put into building your robot | Wayne Doenges | General Forum | 16 | 29-01-2002 19:30 |
| put effort into thread subject | Brandon Martus | General Forum | 12 | 28-01-2002 19:12 |