Tricky C questions
以下是几个棘手的
C 问题, 很难做, 看看自己会做几个?
How do you write a program which produces its own source code as its output?
How can I find the day of the week given the date?
Why doesn’t C have nested functions?
What is the most efficient way to count the number of bits which are set in a value?
How can I convert integers to binary or hexadecimal?
How can I call a function, given its name as a string?
How do I access command-line arguments?
How can I return multiple values from a function?
How can I invoke another program from within a C program?
How can I access memory located at a certain address?
How can I allocate arrays or structures bigger than 64K?
How can I find out how much memory is available?
How can I read a directory in a C program?
How can I increase the allowable number of simultaneously open files?
What’s wrong with the call fopen(”c:\newdir\file.dat”, “r”)
?
without using third variable how to swap two variable?
print a semicolon without using semicolon else where in the program ?
引用: Tricky C questions
相关文档:
数组赋值我总结一下吧也就三种,那char的来举例:
定义的时候直接赋值.
1:char a[20] = "Hello World!";
2: char a[20];
strcpy(a, "Hello World!");
3:char a[20] = {'H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd', '!'};
常见错误赋值方式:
1:char a[20];
a = "Hello World ......
C/C++ development with the Eclipse Platform
Pawel Leszek
摘要:通过本文你将获得如何在Eclipse平台上开发C/C++项目的总体认识。虽然Eclipse主要被用来开发Java项目,但它的框架使得它很容易实现对其他开发语言的支持。在这篇文章里,你将学会如何使用CDT(C/C++ Development Toolkit),一个在Eclipse平台上最 ......
一个控制台下的数字表达式求值程序 (c/c++)
源代码见下:
#include <stdio.h>
#include <string>
#include <iostream>
#include <stdlib.h>
#include <vector>
#include <stack>
using namespace std;
//设置运算符优先级的算法
int Priority(const string opera) // 运算符 ......
(注,本文是翻译的http://www.cprogramming.com/
上的文章 Where C and C++ Differ
)
C++基于C,也保留了C的大部分特性。但是在源码级上有些地方是与C不兼容的。
C程序员使用C++时的陷阱
从 void* 的隐式分配
不能从 void* 隐式地分配到其他任何类型。例如,下面的代码在C中是非常有效的。
in ......