(ת)Ò»¸ö¼òµ¥µÄ´øÍ·Î²Ö¸Õëµ¥ÏòÁ´±í£¨CʵÏÖ£©
ÓÃCдÁËÒ»¸ö´øÍ·Î²Ö¸ÕëµÄµ¥ÏòÁ´±í£¬½öÔÚβ²¿½øÐвåÈë²Ù×÷£¬ÔÚÈÎÒâλÖýøÐÐɾ³ý²Ù×÷¡£ÒòΪֻÓõ½ÕâôЩ¹¦ÄÜ£¬ÓÖÒòΪÀÁ£¬ËùÒÔûÓÐÀ©Õ¹¡£ÒòΪ²åÈëÊǹ̶¨ÔÚβ²¿½øÐУ¬´øÒ»¸öβָÕëµÄºÃ´¦ÊÇÏÔ¶øÒ×¼ûµÄ¡£µ±È»É¾³ýʱҪ¸¶³öһЩ¿ªÏú¡£
¡¡¡¡list.h
¡¡¡¡£££££££££££££££££££££££££££££££££££££££££££
¡¡¡¡/* list.h
¡¡¡¡** Copyright 2004 Coon Xu.
¡¡¡¡** Author: Coon Xu
¡¡¡¡** Date: 06 Sep 2004
¡¡¡¡*/
¡¡¡¡#ifndef LIST_H
¡¡¡¡#define LIST_H
¡¡¡¡#include <stdio.h>
¡¡¡¡#include <stdlib.h>
¡¡¡¡struct listnode
¡¡¡¡{
¡¡¡¡ struct listnode* next;
¡¡¡¡ int data;
¡¡¡¡};
¡¡¡¡struct list
¡¡¡¡{
¡¡¡¡ struct listnode* head;
¡¡¡¡ struct listnode* tail;
¡¡¡¡ int count;
¡¡¡¡};
¡¡¡¡void list_init(struct list*);
¡¡¡¡void list_insert(struct list*, struct listnode*);
¡¡¡¡int list_delete(struct list*, struct listnode*);
¡¡¡¡#endif
¡¡¡¡££££££££££££££££££££££££££££££££££££££££££
¡¡¡¡list.c
¡¡¡¡££££££££££££££££££££££££££££££££££££££££££
¡¡¡¡/* list.c
¡¡¡¡** Copyright 2004 Coon Xu.
¡¡¡¡** Author: Coon Xu
¡¡¡¡** Date: 06 Sep 2004
¡¡¡¡*/
¡¡¡¡#include "list.h"
¡¡¡¡void list_init(struct list* myroot)
¡¡¡¡{
¡¡¡¡ myroot->count = 0;
¡¡¡¡ myroot->head = NULL;
¡¡¡¡ myroot->tail = NULL;
¡¡¡¡}
¡¡¡¡void list_insert(struct list* myroot, struct listnode* mylistnode)
¡¡¡¡{
¡¡¡¡ myroot->count++;
¡¡¡¡
¡¡¡¡ mylistnode->next = NULL;
¡¡¡¡ if(myroot->head == NULL)
¡¡¡¡ {
¡¡¡¡ myroot->head = mylistnode;
¡¡¡¡ myroot->tail = mylistnode;
¡¡¡¡ }
¡¡¡¡ else
¡¡¡¡ {
¡¡¡¡ myroot->tail->next = mylistnode;
¡¡¡¡ myroot->tail = mylistnode;
¡¡¡¡ }
¡¡¡¡}
¡¡¡¡int list_delete(struct list* myroot, struct listnode* mylistnode)
¡¡¡¡{
¡¡¡¡ struct listnode* p_listnode = myroot->head;
¡¡¡¡ struct listnode* pre_listnode;
¡¡¡¡
¡¡¡¡ //myroot is empty
¡¡¡¡ if(p_listnode == NULL)
¡¡¡¡ {
¡¡¡¡ return 0;
¡¡¡¡ }
¡¡¡¡
¡¡¡¡ if(p_listnode =
Ïà¹ØÎĵµ£º
¸Õ¿ªÊ¼Ñ§C/C++ʱ£¬Ò»Ö±¶Ô×Ö·û´®´¦Àíº¯ÊýÒ»Öª°ë½â£¬ÕâÀïÁоÙC/C++×Ö·û´®´¦Àíº¯Êý£¬Ï£Íû¶Ô³õѧÕßÓÐÒ»¶¨µÄ°ïÖú¡£
C£º
char st[100];
1. ×Ö·û´®³¤¶È
strlen(st);
2. ×Ö·û´®±È½Ï
strcmp(st1,st2);
strncmp(st1,st2,n); °Ñst1,st2µÄǰn¸ö½øÐбȽϡ£
3. ¸½¼Ó
& ......
1. ×Ö·û´®²Ù×÷º¯Êý
³ÌÐò°´¹¦ÄÜ»®·Ö¿É·ÖΪÊýÖµÔËËã¡¢·ûºÅ´¦ÀíºÍI/O²Ù×÷ÈýÀ࣬·ûºÅ´¦Àí³ÌÐòÕ¼Ï൱´óµÄ±ÈÀý£¬·ûºÅ´¦Àí³ÌÐòÎÞ´¦²»ÔÚ£¬±àÒëÆ÷¡¢ä¯ÀÀÆ÷¡¢OfficeÌ×¼þµÈ³ÌÐòµÄÖ÷Òª¹¦Äܶ¼ÊÇ·ûºÅ´¦Àí¡£ÎÞÂ۶ิÔӵķûºÅ´¦Àí¶¼ÊÇÓɸ÷ÖÖ»ù±¾µÄ×Ö·û´®²Ù×÷×é³ÉµÄ£¬±¾½Ú½éÉÜÈçºÎÓÃCÓïÑԵĿ⺯Êý×ö×Ö·û´®³õʼ»¯¡¢È¡³¤¶È¡¢¿½±´¡¢Á¬½ ......
< type="text/javascript">
ÔÎÄÇë¼ûÕâÀï
¡£
GNU
CµÄÒ»´óÌØÉ«£¨È´²»±»³õѧÕßËùÖª£©¾ÍÊÇ__attribute__»úÖÆ¡£__attribute__¿ÉÒÔÉèÖú¯ÊýÊôÐÔ£¨Function
Attribute£©¡¢±äÁ¿ÊôÐÔ£¨Variable Attribute£©ºÍÀàÐÍÊôÐÔ£¨Type Attribute£©¡£
__attribute__ÊéÐ´ÌØÕ÷ÊÇ£º__attribute__ǰºó¶¼ÓÐÁ½¸öÏ»® ......
/*
* Exercise 2-5 Page 48
*
* Write the function any(s1,s2), which returns the first location
* in the string s1 where any character from the string s2 occurs,
* or -1 if s1 contains no characters from s2. (The standard library
* function strpbrk does the same job but returns a pointer t ......