Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct SubStruct
- {
- int var;
- SubStruct* pSubNext;
- };
- SubStruct* pHead;
- void add_to_head(int wut)
- {
- SubStruct* temp = pHead;
- if (!pHead)
- {
- pHead = new SubStruct;
- pHead->var = wut;
- }
- temp = new SubStruct;
- temp->pSubNext = pHead;
- pHead = temp;
- }
- int _tmain(int argc, _TCHAR* argv[])
- {
- add_to_head(88);
- add_to_head(77);
- add_to_head(66);
- add_to_head(55);
- add_to_head(44);
- SubStruct* temp = pHead;
- while (temp)
- {
- printf("%d\n", temp->var);
- temp = temp->pSubNext;
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement