c++ 读取访问权限冲突。
#include <stdio.h>
#include <stdlib.h>
#include "stdafx.h"
using namespace std;
typedef struct Node
{
int m_nValue;
Node *m_pNext;
}ListNode;
ListNode * creat_List() {
ListNode *pHead;
pHead = new ListNode();
pHead->m_nValue = 0;
pHead->m_nValue = NULL;
return pHead;
}
ListNode*insert_Node_behind(ListNode*pHead, int pElem) {
if (pHead = NULL) {
cout << "头结点为空" << endl;
return pHead;
}
ListNode *temp, *current;
current = pHead;
while (current->m_pNext)
{
current = current->m_pNext;
}
temp = new ListNode();
temp->m_nValue = pElem;
temp->m_pNext = NULL;
current->m_nValue += 1;
return pHead;
}
void show_List(ListNode *pHead)
{
if (pHead==NULL)
{
cout << "头结点为空" << endl;
return;
}
ListNode *temp;
temp = pHead->m_pNext;
cout << "该list为:";
while (temp!=NULL)
{
cout << temp->m_nValue << ' ';
temp = temp->m_pNext;
}
cout << endl;
}
ListNode *reverse_list_1(ListNode *pHead) {
if (pHead==NULL||NULL==pHead->m_pNext)
{
return pHead;
}
ListNode *temp, *current;
current = pHead->m_pNext;
pHead->m_pNext = NULL;
while (current!=NULL)
{
temp = current->m_pNext;
current->m_pNext = pHead->m_pNext;
pHead->m_pNext = current;
current = temp;
}
return pHead;
}
int main()
{
int n_of_list = 6;
int i = 1;
ListNode *pHead;
pHead = creat_List();
while (n_of_list>0)
{
insert_Node_behind(pHead, i++);
n_of_list;
}
show_List(pHead);
reverse_list_1(pHead);
show_List(pHead);
return 0;
}
#include <stdlib.h>
#include "stdafx.h"
using namespace std;
typedef struct Node
{
int m_nValue;
Node *m_pNext;
}ListNode;
ListNode * creat_List() {
ListNode *pHead;
pHead = new ListNode();
pHead->m_nValue = 0;
pHead->m_nValue = NULL;
return pHead;
}
ListNode*insert_Node_behind(ListNode*pHead, int pElem) {
if (pHead = NULL) {
cout << "头结点为空" << endl;
return pHead;
}
ListNode *temp, *current;
current = pHead;
while (current->m_pNext)
{
current = current->m_pNext;
}
temp = new ListNode();
temp->m_nValue = pElem;
temp->m_pNext = NULL;
current->m_nValue += 1;
return pHead;
}
void show_List(ListNode *pHead)
{
if (pHead==NULL)
{
cout << "头结点为空" << endl;
return;
}
ListNode *temp;
temp = pHead->m_pNext;
cout << "该list为:";
while (temp!=NULL)
{
cout << temp->m_nValue << ' ';
temp = temp->m_pNext;
}
cout << endl;
}
ListNode *reverse_list_1(ListNode *pHead) {
if (pHead==NULL||NULL==pHead->m_pNext)
{
return pHead;
}
ListNode *temp, *current;
current = pHead->m_pNext;
pHead->m_pNext = NULL;
while (current!=NULL)
{
temp = current->m_pNext;
current->m_pNext = pHead->m_pNext;
pHead->m_pNext = current;
current = temp;
}
return pHead;
}
int main()
{
int n_of_list = 6;
int i = 1;
ListNode *pHead;
pHead = creat_List();
while (n_of_list>0)
{
insert_Node_behind(pHead, i++);
n_of_list;
}
show_List(pHead);
reverse_list_1(pHead);
show_List(pHead);
return 0;
}
...全文
相关推荐
C++访问权限冲突解析[项目源码]
文章详细分析了C++编程中常见的“读取访问权限冲突”异常问题,主要分为两种情况:数组访问越界和空指针异常。在数组访问越界方面,作者通过队列和栈的操作示例,解释了由于逻辑错误导致指针超出数组边界的情况,并提供了修改建议。在空指针异常方面,作者以链表操作为例,指出未初始化指针会导致空指针异常,并展示了如何通过初始化指针来解决问题。文章还提到,空指针异常可能出现在数据库查询等其他场景中,并给出了常见的异常提示。最后,作者谦虚地表示这是第一次写博客,欢迎指正。
C++共享内存进程间通信 demo
C++共享内存进程间通信 FileMapping用于进程间快速通信
c++实现内存搜索源代码(和CE差不多)
c++实现内存搜索源代码(和CE差不多);c++实现内存搜索源代码(和CE差不多);c++实现内存搜索源代码(和CE差不多).
vc6.0读取内存数据
获取进程句柄,然后读取内存里面的数据,内容设计unicode编程等
读取文件信息.rar
读取文件信息.rar 读取文件信息.rar 读取文件信息.rar


