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
Ïà¹ØÎĵµ£º
Ò»¡¢c++ µ÷C:
/* cÓïÑÔÍ·Îļþ£ºcExample.h */
#ifndef C_EXAMPLE_H
#define C_EXAMPLE_H
#ifdef __cplusplus
extern "C"
{
#endif
int add(int x,int y);
#ifdef __cplusplus
}
#endif
#endif
/* cÓïÑÔʵÏÖÎļþ£ºcExample.c */
#include "cExample.h"
int add( int x, int y )
{
return ......
°æÈ¨ÉêÃ÷£ºÒÔÏÂÄÚÈÝÊôÓÚ×÷ÕßÕýÔÚд×÷µÄ¡¶Èí¼þ²âÊÔʵ¼ù¡·Ò»ÊéµÄÄÚÈÝ£¬Î´¾Ðí¿É²»µÃÓÃÓÚÈκÎÕýʽ³ö°æÎïÖУ¬Èç¹û×ªÔØÇë×¢Ã÷³ö´¦¡£
×÷ÕߣºÖÜΰÃ÷
´úÂë¼ìÊÓÒªµã
´úÂë¼ìÊÓ¼¼ÄÜÊôÓÚ¿ª·¢ÈËÔ±µÄ»ù±¾¹¦£¬Äܹ»ºÜ´ó³Ì¶ÈµØ·´Ó¦³ö¿ª·¢ÈËÔ±µÄÄÜÁ¦Ë®Æ½£¬Ç°Ãæ4.4.1½ÚÒѾ½²¹ýÌá¸ßÆÀÉó¼ìÊӵķ½·¨¡£ÏÂÃæÒÔʵ¼ÊµÄC/C++ÓïÑÔ·½ÃæµÄ´úÂëÀ´½²½â ......
£¨×¢£¬±¾ÎÄÊÇ·ÒëµÄhttp://www.cprogramming.com/
ÉϵÄÎÄÕ Where C and C++ Differ
£©
C++»ùÓÚC£¬Ò²±£ÁôÁËCµÄ´ó²¿·ÖÌØÐÔ¡£µ«ÊÇÔÚÔ´Âë¼¶ÉÏÓÐЩµØ·½ÊÇÓëC²»¼æÈݵġ£
C³ÌÐòԱʹÓÃC++ʱµÄÏÝÚå
´Ó void* µÄÒþʽ·ÖÅä
²»ÄÜ´Ó void* ÒþʽµØ·ÖÅäµ½ÆäËûÈκÎÀàÐÍ¡£ÀýÈ磬ÏÂÃæµÄ´úÂëÔÚCÖÐÊǷdz£ÓÐЧµÄ¡£
in ......
×î½üÔÚ×ö³ÌÐòʱÐèҪʹÓÃÒ»¸öÒѾ±àºÃµÄC³ÌÐòÔ´Îļþ£¨ÓÐÍ·Îļþ£©£¬½«Í·Îļþ¼ÓÈëÒªµ÷ÓõÄÔ´ÎļþÖУ¬µ÷ÓÃÏàÓ¦Cº¯Êý£¬±àÒëʱ³öÏÖÈçÏ´íÎó£º
sss.c(3129) : fatal error C1010: unexpected end of file while looking for precompiled header directive
ÔÚÍøÉϲéÁËÏà¹Ø×ÊÁÏ£¬Ëµ²»ÄÜÔÚCÔ´ÎļþÖаüº¬"stdafx.h"Îļþ£¬
ÖªµÀÐèÒªÒ ......