Error -- memory violation : Exception ACCESS_VIOLATION received

 

by:授客 QQ1033553122

测试代码:

Action()

{

char *a = NULL;

strcpy(a, "shouke");

return 0;

}

运行报错:

Action.c(4): Error: C interpreter run time error: Action.c (4):  Error -- memory violation : Exception ACCESS_VIOLATION received.

Action.c(4): Notify: CCI trace: Action.c(4): strcpy(0x00000000, 0x032b0111 "shouke")

.

Action.c(4): Notify: CCI trace: Compiled_code(0): Action()

原因分析:

char *a = NULL; a为指向栈内存的指针,暂时值为NULL,指向内存为空。所以,不能用于存放内容。

改正方法:

法一,用数组开辟栈内存

Action()

{

#char *a = NULL;

char a[20]={0};

strcpy(a, "shouke");

return 0;

}

法二,开辟堆内存:

Action()

{

char *a = NULL;

a = (char *)malloc(sizeof(char)*20);

strcpy(a, "shouke");

free(a);

a = NULL;

return 0;

}

排错-Error--memory violation  Exception ACCESS_VIOLATION received解决方的更多相关文章

  1. 一次lr异常Error: C interpreter run time error: Action.c (17): Error -- memory violation : Exception ACCESS_VIOLATION received问题分析

    今天qq群里人问我一个问题 人家的原始问题如下: 问题是为啥通过lr_save_string取不到参数值 由于别的问题,我也需要调试,但是没有环境,只能模拟场景,如下 他想将token变量换成lr中的 ...

  2. Error:java: Internal compiler error: java.lang.Exception: java.lang.NoClassDefFoundError解决

    场景:将Eclipse的可以运行的项目转到IDEA发现一个奇怪的错误 今天用IDEA2018.1运行SpringBoot项目报错如下: Error:java: Internal compiler er ...

  3. Kafka中错误:Unrecognized VM option ‘UseCompressedOops’ Error: Clould not create the Java Vritual Machine. Error: A fatal exception has occurres . Program will exit.

    错误的描述: 在kafka安装目录下,执行 $ bin/zookeeper-server-start.sh config/zookeeper.properties & Unrecognized ...

  4. java virtual machine launcher Error:Could not create the Java Virtual Machine. Error:A Fatal exception has occurred,Program will exit.

    Error:Could not create the Java Virtual Machine. Error:A Fatal exception has occurred,Program will e ...

  5. window10 安装出现the error code is 2503错误的解决方法

    window10 安装出现the error code is 2503错误的解决方法:  设置 C:\WINDOWS\TEMP的权限

  6. Fatal error: Call to undefined function imagettftext()解决办法

    Fatal error: Call to undefined function imagettftext()解决办法   我的问题是php编译安装时指定了gd的目录,其实不用指定.就可以了 博客分类: ...

  7. MyEclipse+Tomcat 启动时出现A configuration error occured during startup错误的解决方法

    MyEclipse+Tomcat 启动时出现A configuration error occured during startup错误的解决方法 分类: javaweb2013-06-03 14:4 ...

  8. ERROR SparkUncaughtExceptionHandler: Uncaught exception in thread

    ERROR SparkUncaughtExceptionHandler: Uncaught exception in thread Thread[appclient-registration-retr ...

  9. Eclipse 出现Some sites could not be found. See the error log for more detail.错误 解决方法

    Eclipse 出现Some sites could not be found.  See the error log for more detail.错误 解决方法 Some sites could ...

随机推荐

  1. socket练习:FTP

    FTP 练习收获: 1,类型转换 2,进度条实现: 3,print 输出不换行的方法: print输出 不换行的方法: 方法一: import sys   sys.stdout.write(" ...

  2. jieba分词(3)

    jieba分词中Tokenize的使用,Tokenize主要是用来返回词语在原文的弃之位置,下面贴上代码: #-*- coding:utf-8 -*- from __future__ import u ...

  3. TDD并不是看上去的那么美

    原文:http://coolshell.cn/articles/3649.html 春节前的一篇那些炒作过度的技术和概念中对敏捷和中国ThoughtWorks的微辞引发了很多争议,也惊动了中国Thou ...

  4. [原] ubuntu安装Fcitx输入法

    1.终端输入: sudo add-apt-repository ppa:wengxt/fcitx-nightly 按回车确认添加 2.sudo apt-get update 更新软件源 3.sudo ...

  5. Excelbatis-一个将excel文件读入成实体列表、将实体列表解析成excel文件的ORM框架,简洁易于配置、可扩展性好

    欢迎使用Excelbatis! github地址:https://github.com/log4leo/Excelbatis Excelbatis的优点 和spring天然结合,易于接入 xsd支持, ...

  6. OopMap介绍

    摘自:http://blog.csdn.net/woaigaolaoshi/article/details/51439227 在HotSpot中,对象的类型信息里有记录自己的OopMap,记录了在该类 ...

  7. google 被墙的解决办法

    昨晚无意中发现的东西,分享给各位使用,google搜索技术方面的东西还是很准确的,可惜被墙了,但是上有政策下有对策…… 谷歌地址: http://74.125.224.18/ http://91.21 ...

  8. gitlab之gitlab-ci和gitlab-runner<一>

    一.概述 gitlab是开源代码托管软件,有ce和ee两种版本,一般情况下ce完全能满足企业使用,如果不差钱可以使用ee版本,这里使用的是ce版.之前也一直在做CI/CD,最开始采用gitlab+we ...

  9. AJAX unsupported media type 415错误处理

    一.问题 在使用angular做请求拦截时,因为依赖循环的问题,在请求拦截中改为使用ajax来发起请求拿到我想要的数据,结果出现了415 Unsupported Media Type错误,由于很久没使 ...

  10. UIView动画上

    主要参考:http://blog.csdn.net/huifeidexin_1/article/details/7597868  http://www.2cto.com/kf/201409/33566 ...