- 博客(11)
- 资源 (4)
- 收藏
- 关注
原创 在mfc中添加控制台,实现printf
#include <io.h> #include <fcntl.h>void InitConsoleWindow(){AllocConsole();HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);int hCrt = _open_osfhandle((long)handle,_O_TEXT);FILE * hf...
2018-09-28 17:36:07 1195
原创 结构体可以直接用=互相赋值,,,!
郁闷了,原来可以直接操作,绕那么大圈void main(){ STU stu1={0,10}; STU temp={12,88};//STU * p1=&stu1;//STU * p2=&temp;printf("%d-%d\n",temp.name,temp.num); temp=stu1;printf("%d-%d\n",temp.name,...
2018-09-21 16:37:23 17581 2
原创 结构体指针替换
#include<stdio.h>typedef struct {char name;int num;}STU;void change(STU *p1,STU *p2){*p2=*p1;}void main(){ STU stu1={0}; STU temp={12,88}; printf("%d-%d\n",temp.name,te...
2018-09-21 15:39:20 474
原创 结构体强制转换
struct student{int name;int age;}student;typedef struct student* Pstu;void main(){ int a[2]={15,16}; printf("%d",((Pstu)a)->name); printf("%d",((Pstu)a)->age);}结果:还可...
2018-09-17 20:14:13 2379
原创 结构体指针必须用->
struct student{int name;int age;}student;typedef struct student* Pstu;void main(){Pstu p;//变量定义p->name=0;p.age=0;}compile:error C2231: '.age' : left operand points to 'struct', use...
2018-09-17 19:46:50 3799
原创 二维数组malloc与free
特别适用于C语言动态字符串数组操作#include <stdio.h>typedef unsigned int wchar;#define LENGTH 10//需求:字符串数组的二维数组动态开辟//name[n][LENGTH] 。。。。。。。。。。// 。。。。。。。。。。// 。。。。。...
2018-09-17 18:52:11 5416
原创 同级传递形参达不到想要效果,平级指针传递也不行
#include <stdio.h>typedef unsigned int wchar;int i=9;//全局变量,指针固定int * changeptr(int * p)//指针加1{p=p+1;return p;}void main(){ int *addr=&i; printf("%d\-%d\n",&i,i);...
2018-09-17 18:15:15 207
原创 malloc和free在两个函数中实现
char* creat(void){ char* p=(char*)malloc(sizeof(char)*10); return p;}void del(char *p){ free(p); p=NULL;}int main(){ del(creat());} 通过指针传递, p=NULL;这句是精华,工程做的好的会把p赋...
2018-09-17 17:28:01 947
原创 结构体指针做形参(两个结构体互换)
对比两个程序就懂啦,我真聪明,竟然想出这种直接互换结构体的方法程序一:#include <stdio.h>typedef struct{char num1;char num2;}INFO; INFO * info=NULL; INFO * info1=NULL;void changep(INFO* p1,INFO* p2){INFO *p;p=p1;...
2018-09-13 14:40:56 8033 2
原创 malloc与直接定义变量的区别
//vc6.0编译环境下代码#include "stdio.h"#include "malloc.h"#define N 5 //malloc申请内存 int *function1(){ int i; int *a=(int *)malloc(sizeof(int)*N); for(i=0;i<N;i++) { a[i]=i+1;...
2018-09-06 13:56:28 2207
ucos3消息队列简单应用举例(keil5工程压缩包)
2018-06-26
简单串口收发功能的MFC工程
2018-06-26
基于stm32f103VET的ucosIII/ucos3工程keil5,可以直接编译下载,自己动手亲测可用
2018-06-19
stm32f103串口BootLoader工程及APP工程(自己动手,亲测可用)
2018-03-09
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人