究竟什么是用户态,什么是内核态,这两个基本概念以前一直理解得不是很清楚,根本原因个人觉得是在于因为大部分时候我们在写程序时关注的重点和着眼的角度放在了实现的功能和代码的逻辑性上,先看一个例子:
1)例子
C代码
1. void testfork(){
2. if(0 = = fork()){
3. printf(“create new process...
分类:
系统相关 时间:
2014-09-23 18:21:25
阅读次数:
429
在printf时:如果以%f格式输出,将输出8个字节(scanf输入时,%f是4个字节)
在参数入栈时如果是float型或者double型 直接入栈8个字节,此时输出及后续输出都没问题
但如果参数小于8个字节且不是float型:比如int shor int ,就会扩展符号位,成为4个字节再入栈,但是输出的是8个...
分类:
编程语言 时间:
2014-09-23 17:17:05
阅读次数:
286
#include #include #include void ArrPrint(std::vector const & arr){ for (auto i : arr){ printf("%d ", i); } printf("\n");}//iBase 桶数void radixsort(std....
分类:
其他好文 时间:
2014-09-23 14:52:04
阅读次数:
236
第九题#include int main(){ float f=0.0f; int i; for(i=0;i”“int main(){ int a = 1,2; printf("a : %d\n",a); retur...
分类:
其他好文 时间:
2014-09-23 09:51:14
阅读次数:
345
第六题 #include int main() { int a=10; switch(a) { case '1': printf("ONE\n"); ...
分类:
其他好文 时间:
2014-09-23 08:44:54
阅读次数:
225
第二十一题What is the potential problem with the following C program? #include int main() { char str[80]; printf("Enter the string:"); ...
分类:
其他好文 时间:
2014-09-23 08:28:54
阅读次数:
287
//break是结束整个循环体,continue是结束单次循环比方说:
while(x++ < 10)
{
if(x == 3)
{
break;
}
printf("%d\r\n", x);
}
结果是输出 1 2 就退出了整个while循环
但是如果使用continue
while(x++ < 10)
{
if(x == 3...
分类:
其他好文 时间:
2014-09-22 23:36:33
阅读次数:
172
/*一个使用指针的简单程序*/#include void main(){ int number = 0; //一个出初始化为0的整形变量 int *pointer = NULL; //一个可以指向int类型的指针 number = 10; printf("\nnu...
分类:
其他好文 时间:
2014-09-22 23:11:13
阅读次数:
221
1.设计库源码pr1.c1 void print1()2 {3 printf("This is the first lib src \n");4 }View Codepr2.c1 void print2()2 {3 printf("This is the second lib src...
分类:
编程语言 时间:
2014-09-22 20:45:43
阅读次数:
151
#include #include typedef struct DataNode{ int (*handle)();}tDataNode;int print(){ printf("Hello World!\n"); return 0;}int main(){ int a = 0; tDataNod...
分类:
其他好文 时间:
2014-09-22 20:39:53
阅读次数:
166