指针的动态分配怎么运行后老出现这个问题
来源:互联网 发布:2017中日贸易数据 编辑:程序博客网 时间:2024/04/29 23:18
代码:
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
void main()
{
int a[50]={0};
int j=0,i=0,n=0,m=0;
printf("please input the mark(student number between 0-50)and end with a number litter than 0: \n");
for(j=0;j<50;j++)
{
scanf("%d",&a[j]);
if(a[j]<0)
{
break;
}
}
int *q = (int *)malloc(j-2);
q=&a[0];
while(m==0)
{
printf("please input the student you want to search\n");
scanf("%d",&i);
printf("%d\n",*(q+i-1));
printf("if you want to continue plesae input 0,enter any to esc:\n");
scanf("%d",&m);
}
if(q!=NULL)
{
free(q);
q=NULL;
}
}
- 指针的动态分配怎么运行后老出现这个问题
- 老出现这个问题
- 运行VS2010后CPU占用率高,鼠标指针旁的沙漏一闪一闪,终于解决这个问题了!
- tomcat运行出错,请问这个问题怎么解决?
- ssm框架运行出现这个问题怎么办急用
- post表单提交后,后台获取数据为null 大量数据的时候会出现这个问题
- 递归、内存的动态分配、指针
- 动态分配内存的指针问题
- oracle表的导出这个问题怎么解决
- 使用LaunchScreen.storyboard后,运行时显示老的图片
- 运行时老出现Spawning c1.exe的问题
- android studio 安装时,出现这个问题,该怎么解决?
- android studio 安装时,出现这个问题,该怎么解决?
- 在创建job的时候出现这个问题
- 运行ase的sybase central 时提示错误unable to load language dll 'scsslgzh',怎么解决这个问题,
- 在win8系统下,装matlab7.0成功后运行时出现runtime error的错误怎么解决?
- 哪位大哥知道怎么用new动态分配一个指针数组?
- 动态数组的使用(动态分配,指针)
- 二进制“<<”: 没有找到接受“std::string”类型的右操作数的运算符(或没有可接受的转换)
- java list
- 论 NoSQL 的数据模型
- C 代码----在MCU中构建消息队列
- 删除字符串中多余的空格
- 指针的动态分配怎么运行后老出现这个问题
- Symmedian
- Win32汇编的 PTR, OFFSET, ADDR
- (第四周任务一) 定义类的成员函数
- MySQL Replication同步复制的延时监控
- 在排序数组中,找出给定数字的出现次数
- 技术与理论
- TCP/IP 协议简单分析
- HDUOJ Knight Moves解题报告