易截截图软件、单文件、免安装、纯绿色、仅160KB

C puzzles


Authentication
Login with:New JS-Kit account
Google Friend Connect
Twitter account
FriendFeed account
Yahoo account
Blogspot URL
JS-Kit account
Haloscan account
OpenID
Dear visitor,
Thanks for your interest in C programming.
In this page, you will find a
list of interesting C programming questions/puzzles,
These programs listed are the ones which I have received as
e-mail forwards from my friends, a few I read in some books, a few from the
internet, and a few from my coding experiences in C.

Most of the programs are meant to be compiled, run and
to be explained for their behaviour. The puzzles/questions can be broadly
put into the following categories:

General typo errors, which C programmers do often and are
very difficult to trace.

Small programs which are extremely hard to understand at the first
examination. These questions make a good excercise of reading and understanding
effecient code written by others.

I have used Gnu/Linux/gcc for all of them.
The order in which the programs appear doesn't have
any relation with the level of difficulty.
Please feel free to contact me if you need any help in solving the problems.
My contact info. is available here
And you might be interested in a few references for C programming
,
which I personally found very interesting.
If you are preparing for campus interviews, you might find the following
link interesting:
http://placementsindia.blogspot.com
Regards,
Gowri Kumar
C puzzles
The expected output of the following C program
is to print the elements in the array. But when
actually run, it doesn't do so.
#include
<stdio.h>
#define

TOTAL_ELEMENTS
(
sizeof
(
array
)
/

sizeof
(
array
[
0
]))
int
array
[] =
{23
,34
,12
,17
,204
,99
,16
};
int
main
()
{
int
d
;
for
(d
=-
1
;d
<=
(TOTAL_ELEMENTS
-
2
);d
++
)
printf
(&q


相关文档:

LINUX C中用define定义可变参数的宏

  一般在调试打印Debug信息的时候, 需要可变参数的宏. 从C99开始可以使编译器标准支持可变参数宏(variadic macros), 另外GCC也支持可变参数宏, 但是两种在细节上可能存在区别.
1. __VA_ARGS__
        __VA_ARGS__ 将 "..." 传递给宏 . 如
     ......

C编译的伪指令

一般变量定义在*.c文件中,而*.h文件中声明变量或函数名和符号名.
避面重复编译的解决方法:
    比如你有两个C文件,这两个C文件都include了同一个头文件。而编译时,这两个C文件都要调用同一个头文件去编译,重复编译会产生大量的声明冲突。解决这个问题的方法使用#ifndef, #endif, #endif。
 &nbs ......

[转贴]linux下c语言嵌入汇编

 网上看到的这篇关于Linux下C语言嵌入汇编的文章写的非常全,转载过来。
Using Assembly Language in Linux.
Intel和AT&T汇编语法差异:
1。前缀:
Intel汇编寄存器和立即数无需前缀。后者寄存器前缀为%,立即数前缀为$。
eg:
   Intex Syntax
   mov eax,1
   mov ebx,0f ......

写好C程序的10大要点

要写好C语言程序,最重要的当然是把要解决的问题分析清楚,设计好解决问题的方案和通过计算实现求解的过程,对问题的求解过程进行科学的结构化的分解。在此基础上进一步考虑如何写程序的时候,下面的建议可能有所帮助。
这些建议中有些是一般性的,不仅仅对C语言程序设计有效;也有些是特别针对C语言程序设计的。这个表还 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号