第三十八题 What is the bug in the following program? #include <stdlib.h> #include <stdio.h> #define SIZE 15 int main() { int *a, i; a = malloc(SIZE*sizeof(int)); ; i<SIZE; i++) *(a + i) = i * i; ; i<SIZE; i++) printf("%d\n", *a++);…
第九题 #include <stdio.h> int main() { float f=0.0f; int i; ;i<;i++) f = f + 0.1f; if(f == 1.0f) printf("f is 1.0 \n"); else printf("f is NOT 1.0\n"); ; } 知识点讲解: 浮点寄存器 浮点寄存器是FPU的组成部分.硬件架构不同,浮点寄存器的个数和位数也不同.X86架构的浮点寄存器有: 1)8个80位的数据…
第五十一题 Write a C function which does the addition of two integers without using the '+' operator. You can use only the bitwise operators.(Remember the good old method of implementing the full-adder circuit using the or, and, xor gates....) 题目讲解: 参考:ht…
第四十六题 What does the following macro do? #define ROUNDUP(x,n) ((x+n-1)&(~(n-1))) 题目讲解: 参考:http://bbs.chinaunix.net/forum.php?mod=viewthread&tid=814501 用于内存对齐,n为2的幂. 第四十七题 Most of the C programming books, give the following example for the definitio…
第三十四题 The following times. But you can notice that, it doesn't work. #include <stdio.h> int main() { int i; ; ; i < n; i-- ) printf("-"); ; } Well fixing the above code is straight-forward. To make the problem interesting, you have to f…
第三十一题 The following is a simple C program to read and print an integer. But it is not working properly. What is(are) the mistake(s)? #include <stdio.h> int main() { int n; printf("Enter a number:\n"); scanf("%d\n",n); printf(&quo…
第二十六题(不会) The following is a simple program which implements a minimal version of banner command available on most *nix systems. Find out the logic used in the program. #include<stdio.h> #include<ctype.h> char t[]={ ,,,,,,,,,, ,,,,,,,,,, ,,,,,…
第二十一题 What is the potential problem with the following C program? #include <stdio.h> int main() { ]; printf("Enter the string:"); scanf("%s",str); printf("You entered:%s\n",str); ; } 题目讲解: 易造成数组越界,scanf改成如下形式比较保险 scanf(…
第十六题 The following is a small C program split across files. What do you expect the output to be, when both of them compiled together and run? File1.c ]; File2.c extern int *arr; int main() { arr[] = ; ; } 题目讲解: 编译完运行发生段错. File1.c中声明的是个数组,File2.c中声明的是…
题目:http://www.gowrikumar.com/c/ 参考:http://wangcong.org/blog/archives/291 http://www.cppblog.com/smagle/archive/2010/05/27/116211.html http://blog.chinaunix.net/uid-474889-id-2397033.html 博文索引: C puzzles详解[1-5题] C puzzles详解[6-8题] C puzzles详解[9-12题] C…
重置出错?微软Win10平板Surface Pro 4重装系统教程详解 2015-12-11 15:27:30来源:IT之家作者:凌空责编:凌空 评论:65 Surface Pro 4系统重置出错该怎么办? Surface Pro 4无法启动该怎办? Surface Pro 4平板如何重装Win10系统? 在Win10刚刚发布时,很多用户在升级Windows10后重置系统时遇到了错误.这一问题在微软自家Surface平板中也同样可能出现.今天IT之家在重置一台Surface Pro 4平板时就遇…
处理器拦截器简介 Spring Web MVC的处理器拦截器(如无特殊说明,下文所说的拦截器即处理器拦截器)类似于Servlet开发中的过滤器Filter,用于对处理器进行预处理和后处理. 常见应用场景 1.日志记录:记录请求信息的日志,以便进行信息监控.信息统计.计算PV(Page View)等. 2.权限检查:如登录检测,进入处理器检测检测是否登录,如果没有直接返回到登录页面: 3.性能监控:有时候系统在某段时间莫名其妙的慢,可以通过拦截器在进入处理器之前记录开始时间,在处理完后记录结束时间…