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
相关文档:
这两天看到有人讨论电话键盘上的字母、号码和字母的转换,我也随便写了一段
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#define MAX_LEN 15
char *tbl_itoa[] =
{
"0", // 0
"1", // 1
"ABC", // 2
"DEF", // 3
"GHI", // 4
"JKL", // 5
"MNO", ......
有谁真正的理解过一个编译器呢?许多人认为TC很简单很落后,但是即便是这样简单的工具,到底有几个人真正的深入理解了呢?一个简单的编译器都不能理解,如何能成为高手,如何能深入的使用更加高级的工具呢?不要以为自己使用的是VC就很了不起,因为使用这样傻瓜化的工具只能让你看不到事物的本质。接下来我们就来深入的认 ......
Netbeans经常会出现写代码的时候代码提示出不来的情况,甚至是代码根本没错,编译都能通过,但是代码帮助就提示我说我有错误,在下面画条红线!而这些问题Eclipse没有出现过!而且Eclipse有专门的CDT插件开发小组,很好强大。 ......
今天解答一些同学在学开发过程中的普遍问题,就是如何学好一门语言?
我是这样来理解的,要做任何事物,首先要分析为什么要做,只有把核心的,内心的原因找到才能把一件事情做好,否则,你花再多的学费学某种技术仍然会一无所或,从我个人的成长过程来将我是从97年接触计算机,开始学的一踏糊涂,不知道老师在讲什么,不知道学了会有什 ......
网上看到的这篇关于Linux下C语言嵌入汇编的文章写的非常全,转载过来。
Using Assembly Language in Linux.
Intel和AT&T汇编语法差异:
1。前缀:
Intel汇编寄存器和立即数无需前缀。后者寄存器前缀为%,立即数前缀为$。
eg:
Intex Syntax
mov eax,1
mov ebx,0f ......