C
文章平均质量分 62
昵称90天可改
这个作者很懒,什么都没留下…
展开
-
fatal error LNK1120: 2 unresolved externals及主函数调用外部函数
主函数中调用外部文件定义的函数,两种方法:第一种:htest.cpp:#include "stdafx.h"#include "stdio.h"extern void b(void);extern void c(void);int main(int argc, char* argv[]){ printf("Welcome to main.\n"); b();原创 2012-07-22 21:43:49 · 4482 阅读 · 0 评论 -
无头单链表逆序(法一)
#include "stdio.h"#include "stdlib.h"#include "time.h"typedef struct node{ int a; struct node* next;}LNODE;LNODE* LinklistCreate(void);void LinklistVisit(LNODE *head);LNODE* LinklistConvert原创 2013-02-27 09:16:05 · 961 阅读 · 1 评论 -
字符串逆序
#include "stdio.h"#include "stdlib.h"#include "string.h"void StrConvert(const char* src,char* const dst);int main(void){ char str[1000] = {0}; char tmp[1000] = {0}; gets(str); printf("befo原创 2013-02-26 20:54:56 · 535 阅读 · 0 评论 -
编写函数实现:整型数转换成字符串
#include "stdio.h"#include "stdlib.h"#include "string.h"void int_to_str(unsigned int src,unsigned char* dest);void main(void){ unsigned int num = 0; unsigned char str[11] = {0}; printf("scan原创 2012-12-15 23:41:58 · 1368 阅读 · 0 评论 -
单向无头链表-学生信息管理系统
这个程序,为练习链表所写,实现了无头单链表的创建、插入、删除、遍历、查找,没添加排序功能。#include "stdio.h"#include "malloc.h"#include "stdlib.h"#include "conio.h"struct stu{ int num; char name[20]; struct stu* next;};struct stu*原创 2012-12-09 20:57:53 · 861 阅读 · 1 评论 -
冒泡排序:小泡
#include "stdafx.h"#include "stdio.h"#include "stdlib.h"#include "time.h"void bubblesort_big_first(int a[],int len);int main(int argc, char* argv[]){ int a[20]; int i; srand(time(NULL));原创 2012-12-04 20:08:54 · 701 阅读 · 0 评论 -
选择排序
#include "stdio.h"#include "stdlib.h"#include "time.h"void ChooseSort(int a[],int len);int main(int argc, char* argv[]){ int a[20]; int i; srand(time(NULL)); for(i=0;i<20;i++) a[i] = ran原创 2012-12-04 20:46:01 · 442 阅读 · 0 评论 -
冒泡排序:大泡
#include "stdafx.h"#include "stdio.h"#include "stdlib.h"#include "time.h"void bubblesort_little_first(int a[],int len);int main(int argc, char* argv[]){ int a[20]; int i; srand(time(NULL))原创 2012-12-04 20:16:09 · 713 阅读 · 0 评论 -
宏中的++、--
1、后++MacroTest1.cpp:#include "stdafx.h"#include "stdio.h"#define program(x) ((x)*(x)*(x))int main(int argc, char* argv[]){ int i=3; printf("i:%d\n",i); int j=program(i++); printf("原创 2012-07-24 18:39:00 · 770 阅读 · 0 评论 -
*temp++=1问题
#include "stdafx.h"#include"stdio.h"int main(int argc, char* argv[]){ int *temp; int b=99; temp=&b; printf("temp is:%d\n",temp); printf("b is:%d\n",b); printf("b's addr is:%d\n\n",原创 2012-07-19 22:58:36 · 2337 阅读 · 0 评论 -
指针越界读、写
1、正常读写pointertest.cpp:#include "stdafx.h"#include "stdio.h"int main(int argc, char* argv[]){ int a[]={11,12,13,14,15,16}; int *p; p=a; for(int i=1;i<7;i++,p++) *p=i+10; p=a; f原创 2012-07-23 18:16:02 · 1379 阅读 · 0 评论 -
无头单链表逆序(法二)
#include "stdio.h"#include "stdlib.h"#include "time.h"typedef struct node{ int a; struct node* next;}LNODE;LNODE* LinklistCreate(void);void LinklistVisit(LNODE *head);LNODE* LinklistConvert原创 2013-02-27 09:16:21 · 629 阅读 · 0 评论