cÓïÑÔ»ù´¡£¨ÊÇʱºò²¹²¹cµÄ»ù´¡ÁË£©
¿´Êý¾Ý½á¹¹ñÍÕ»µÄʱºòдÁËÕâôһ¶Î´úÂë
#include<stdio.h>
#include<stdlib.h>
struct linkstack
{
int data;
struct linkstack *next;
};
int initstack(linkstack * S)
{
S = (linkstack *)malloc(sizeof(linkstack));
if(S == NULL) return 0;
S->next = NULL;
return 1;
}
int main(int argc,char **argv)
{
linkstack S;
if(initstack(&S))
printf("initstack success!!!\n");
return 0;
}
½á¹û±àÒëºó¾Í³öÏÖÁËÕâЩ´íÎó
@-laptop:~/makeprog/stack$ gcc -g -o linkstack main.c
main.c:11: error: expected ‘)’ before ‘*’ token
main.c: In function ‘main’:
main.c:22: error: ‘linkstack’ undeclared (first use in this function)
main.c:22: error: (Each undeclared identifier is reported only once
main.c:22: error: for each function it appears in.)
main.c:22: error: expected ‘;’ before ‘S’
main.c:23: error: ‘S’ undeclared (first use in this function)
ÏëÁËһϹÀ¼ÆÊÇÕâ¸ö½á¹¹Ì嶨ÒåµÄÎÊÌ⣬¾Í¸Ä³ÉÕâÑù
typedef struct node
{
int data;
struct linkstack *next;
}linkstack;
±àÒëͨ¹ý
È»ºóÕÒÒ»ÏÂÔÒò
µÚÒ»ÖÖ·½Ê½¶¨ÒåÁËÒ»¸öÈ«¾Ö
µÄ½á¹¹Ì壬ȻºóÔÚmain£¨£©º¯ÊýÖÐÓÃËüÀ´¶¨ÒåÒ»¸ö±äÁ¿£¬ËùÒÔ²»¿ÉÒÔ¡£µÚ¶þÖÖ·½Ê½ÓÃÁËtypedef£¬²é²éËüµÄÓ÷¨
typedef
ΪCÓïÑԵĹؼü×Ö£¬×÷ÓÃÊÇΪһÖÖÊý¾ÝÀàÐͶ¨ÒåÒ»¸öÐÂÃû×Ö¡£ÕâÀïµÄÊý¾ÝÀàÐÍ°üÀ¨ÄÚ²¿Êý¾ÝÀàÐÍ£¨int,charµÈ£©ºÍ×Ô¶¨ÒåµÄÊý¾ÝÀàÐÍ£¨struct
µÈ£©¡£
¡¡¡¡ÔÚ±à³ÌÖÐʹÓÃtypedef
Ä¿µÄÒ»°ãÓÐÁ½¸ö£¬Ò»¸öÊǸø±äÁ¿Ò»¸öÒ×¼ÇÇÒÒâÒåÃ÷È·µÄÐÂÃû×Ö£¬ÁíÒ»¸öÊǼò»¯Ò»Ð©±È½Ï¸´ÔÓµÄÀàÐÍÉùÃ÷¡£
µ«ÊÇ»¹ÊDz»ÄÜ·ÖÎö³öÀ´µ½µ×ʲôÔÒò£¬ÎÊÎÊȺÀïµÄÅóÓÑ
Ïà¹ØÎĵµ£º
Facts of C Programming Language
CµÄһЩÕƹÊ
(Ó¢ÎÄÔÎÄ:http://www.programmingfacts.com/2009/12/01/facts-of-c-programming-language/)
C programming language was developed in 1972 by Dennis Ritchie and Brian Kernighan at the Bell Telephone Laboratories (AT&T Bell Laboratories) for use with the Un ......
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jee="http://www.springframework.org/schema/jee"
&nbs ......
µÚÒ»²¿·ÖÈí¼þ±à³ÌµÄʱ¼ä·ÖÅä¸Å¿ö
¸ßЧÂʵijÌÐòÔ±²¢²»ÊÇÇüüÅ̵ÄËٶȱȱðÈ˿죬¶øÊÇËûÓÐ×ÅÁ¼ºÃµÄ±à³ÌÏ°¹ß£¬½ÚÊ¡Á˱ðÈËÀ˷ѵÄʱ¼ä¡£Òò´Ë£¬ÒªÏëÌá¸ß×Ô¼ºµÄ±à³ÌЧÂÊ£¬¸ù±¾ÔÚÓÚÔõôÉÙÀË·Ñʱ¼ä¡£Ö»ÒªÄܰѱðÈËÀ˷ѵÄʱ¼ä½ÚÊ¡ÏÂÀ´£¬ÄãµÄЧÂʾͿÉÒÔ¿ì¹ý±ðÈË£¬ÉõÖÁÊý±¶ÓÚ±ðÈË¡£ÒªÏë½Úʡʱ¼ä£¬µ±È»Ê×ÏÈÐèÒªÃ÷°×±à³ÌÖкķ ......
#include <windows.h>
int WINAPI WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nShowCmd )
{
OPENFILENAME ofn;
//ÔÚÄÚ´æÖпª±ÙÒ»¿é¿Õ¼ä£¬´æ·ÅÓû§Ñ¡È¡µÄÎļþÃû
char szFile[MAX_PATH];//MAX_PATH ......