![]() |
|
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
The Oblivious One
Join Date: May 2005
Location: Ontario, Canada
Posts: 646
Rep Power: 4
![]() |
Accessing a pointer-to-structure value
Sorry, this will be the last question of the day :p
say I had this code:
#include <iostream>
using namespace std;
struct Node
{
int value;
};
int main()
{
Node *p;
p->value = 5;
int number;
number = p->value;
cout << number;
return 0;
}This gives me a segmentation fault. How would I fix this?
__________________
Dr. Zoidberg: [ecstatic] I'm going to a movie... with FRIENDS! |
|
|
|
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|