- 博客(5)
- 收藏
- 关注
转载 Volatile
就像constant一样,volatile是一个类型修饰符(type specifier)。它是被设计用来修饰被不同线程访问和修改的变量。如果没有volatile,基本上会导致这样的结果:要么无法编写多线程程序,要么编译器失去大量优化的机会。 volatile的作用: 作为指令关键字,确保本条指令不会因编译器的优化而省略,且要求每次直接读值. 简单地说就是防止
2015-01-29 12:25:02 486
原创 数据结构----迷宫问题
迷宫问题总共包三个头文件函数(Stack.h,Maze.h,AFXSTD.H),两个cpp函数和一个主函数(main),下面分次介绍出来如何实现及测试后数据和通路。 Stcak.h(栈的基本操作函数声明) #define STACK_INIT_SIZE 100 #define STACKINCREMENT 10 //------------ 栈的顺序存储实现 ------------
2015-01-10 22:25:34 1953 1
原创 void my_strcpy
#include void my_strcpy(char *dest,const char *str) { while (*str!='\0') { *dest=*str; dest++; str++; } } int main() { char p[]="asdasd"; char *q="zxczxc"; my_strcpy(p,q); printf("%s\n",p
2015-01-10 22:17:49 524
原创 返回一个二进制位模式反转后的值
#include #include #include int main() { int rel=0;int value; int bit=0; scanf("%d",&value); rel<<=1; bit=value%2; rel=bit; value/=2; printf("%d\n",rel); }
2015-01-10 22:11:27 442
原创 二进制反转输出
int a = 25;//00000000000000000000000000011001 int i; for(i = 0; i <=sizeof(int)*8 - 1; i++){ if((1 << i) & a) printf("%c", '1'); else printf("%c", '0'); }
2015-01-03 17:08:05 674
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人