CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

structure pointers

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
crimp
Guest







structure pointers
PostPosted: Sat May 05, 2007 4:29 pm     Reply with quote

can CCS handle an array of structure pointers
for example

I have an array of structures

Code:
struct MENU_STRUCT{
   
    int location;
    char m1[16];
    int d;
};
struct MENU_STRUCT temps[8];

//pointers
struct MENU_STRUCT *ptrs[8];

//initialize
for(i=0;i<8;i++){
   ptrs[i]=&temps[i];
}


everything above seems OK. But if I try to acces the string with
Code:
ptrs[i]->m1

I get Junk

I use V4.033/PCH on a PIC18f4685
Any help would be appreciated
Thank You
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat May 05, 2007 10:04 pm     Reply with quote

Post a small compilable test program, in which you initialize the
structure data and then try to access by various methods. Put in
printf statements that display the results. Then post the (bad)
results that you're getting, and post the results that you would
like to see.

The program that you post should be "drop in" compilable
right into MPLAB. In other words, include all variable declarations,
#include statements, #use statements, etc.

If you do that, it's possible that we could come up with a solution
or a work-around.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group