|
-
Apr 14th, 2002, 01:37 PM
#1
Thread Starter
Addicted Member
pointer to a struct
i have this struct:
struct temp_rec
{
int iYear;
int iMonth;
int iTemp;
int iLoc;
char* sLoc;
}*trPtr;
and im trying to write values into the pointer and read from the pointer like this:
printf("Please enter the location: ");
scanf(trPtr->sLoc);
its causing a stack dump so i know there is something wrong. There is nothing that goes near the struct anywhere else in the program. what am i doing wrong? I want to use pointers to conserve memory usage. plus i havent really used pointers much, i could do with the practice.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|