![]() |
| | #1 |
| Registered User Join Date: Jan 2009
Posts: 31
| Code: #include <iostream>
using namespace std;
struct structure
{
char c;
int i;
int a[40];
} str;
structure *p;
p = &str;
int main()
{
str.a = 89;
str.c = 89;
str.i = 10;
cout << p-> c;
system("PAUSE");
return 0;
}
|
| RaisinToe is offline | |
| | #2 |
| Registered User Join Date: Jun 2005
Posts: 1,343
| It is not possible to do assignments of pointers outside a function. Specifically, Code: structure *p;
p = &str;
Code: structure *p = &str; |
| grumpy is offline | |
| | #3 |
| Registered User Join Date: Jan 2009
Posts: 31
| Thank you, I have never heard anything about that before. |
| RaisinToe is offline | |
![]() |
| Tags |
| members, point, struct, structure |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Header files and classes | disruptivetech | C++ Programming | 5 | 04-21-2008 09:02 AM |
| Help realy needed | ZohebN | C++ Programming | 2 | 04-08-2008 09:37 AM |
| Can a pointer point to different data structure? | franziss | C Programming | 9 | 09-04-2005 11:51 AM |
| nightmare - understanding whats going on in a linked list | fate | C Programming | 2 | 11-28-2003 11:50 AM |
| Arrays and the POINT structure | incognito | C++ Programming | 11 | 08-02-2002 10:20 PM |