函数间数据拷贝 stack overflow
来源:互联网 发布:淘宝优惠券设置 编辑:程序博客网 时间:2024/04/30 08:41
完成程序,实现对数组的降序排序
#include <stdio.h>
void sort( );
int main()
{
int array[]={45,56,76,234,1,34,23,2,3}; //数字任//意给出
sort( );
return 0;
}
void sort( )
{
____________________________________
}
解答:
#include<stdio.h>
#include<string.h>
void sort() {
int a;
char *p;
static int array2[]={45,56,76,234,1,34,23,2,3}; //数字任//意给出
static int array3[]={1,2,3,23,34,45,56,76,234}; //数字任//意给出
p=(char*)&a;
while(p++) {
if(memcmp(p,array2,sizeof(array2))==0) {
memcpy(p,array3,sizeof(array3));
return;
}
}
}
int main() {
int i;
int array1[]={45,56,76,234,1,34,23,2,3}; //数字任//意给出
sort();
for(i=0;i<8;i++) {
printf("%d/n",array1[i]);
}
return 0;
}
- 函数间数据拷贝 stack overflow
- stack overflow
- stack overflow
- Stack Overflow
- Stack Overflow
- Stack overflow
- stack overflow
- stack overflow
- Stack overflow
- Stack overflow
- Stack overflow
- Stack Overflow
- Stack Overflow
- 函数中定义一个大数组,却stack overflow?
- C++程序刚进入函数崩溃 stack overflow
- Debugging a Stack Overflow
- stack overflow问题
- stack overflow--recursive function
- Android读写XML(下)——创建XML文档
- 三月最后一天杂想
- tomcat安装
- 英语单词的背诵方法
- JAVA工程结构 && CMD使用javac提示非有效命令怎么办
- 函数间数据拷贝 stack overflow
- php 中的单 双引号
- 值得纪念的一天
- lucene:no segments* file found in org.apache.lucene.store.FSDirectory@
- 使用Spring的注解方式注入Struts所管理的action
- 机油的型号
- 愚人节就要到了,我喜欢这个网站~
- cin、cin.get()、cin.getline()、getline()、gets()等函数的用法
- 无题