![]() |
| | #1 |
| Registered User Join Date: Nov 2009
Posts: 2
| Exchange pointers I have a type queue_t, its a head of a linked list. Then I have these variables: queue_t *exe_thr_list[15]; queue_t *expired_thr_list[15]; They are arrays of 15 elements, where each element is a pointer to queue_t (Pretty obvious). So far so good. Now I want to make a function to swich them. What I mean is: what ever exe_thr_list points to must (after the function is called) point to whaever expired_thr_list points to. And vice versa. In other words to swich the two arrays. I made this obviously wrong code: Code: queue_t *tmp_queue[15]; tmp_queue = exe_thr_list; exe_thr_list = expired_thr_list; expired_thr_list = tmp_queue; error: incompatible types in assignment in the last three lines of code. Can someone point me to the light (LOOOL)?? |
| Lasering is offline | |
| | #2 |
| subminimalist Join Date: Jul 2008 Location: NYC
Posts: 3,944
| With an array you must do this: Code: for (i=0; i<15; i++) ray_two[i] = ray_one[i];
__________________ Accuracy and integrity mean nothing if you don't make it past the censors...PYTHAGORAS |
| MK27 is offline | |
| | #3 |
| Registered User Join Date: Nov 2009
Posts: 2
| Actually not. Because its like take you are putting the values of array one in array two, but now putting the values os array two in one. Anyway I think I can resolve my problem with that code. Thks a lot!!. |
| Lasering is offline | |
| | #4 |
| Registered User Join Date: Sep 2006
Posts: 2,502
| This is the fastest 180 degree turn yet seen, on the forum! Those are *some* tires you have there Lasering. |
| Adak is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Using pointers to pointers | steve1_rm | C Programming | 18 | 05-29-2008 05:59 AM |
| Euclid Algorithm (extended)Part2 Doubt about pointers - INITIALIZATION | nacho4d | C Programming | 4 | 12-10-2006 07:08 PM |
| Request for comments | Prelude | A Brief History of Cprogramming.com | 15 | 01-02-2004 10:33 AM |
| Staticly Bound Member Function Pointers | Polymorphic OOP | C++ Programming | 29 | 11-28-2002 01:18 PM |