Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

c°æ±¾Óëc++°æ±¾µÄ¶¯Ì¬Êý×é´úÂë

C°æ±¾£º
vim stash.h
#ifndef STASH_H
#define STASH_H
typedef struct STASHTag {
  int size;  /* Size of each space */
  int quantity; /* Number of storage spaces */
  int next; /* Next empty space */
  /* Dynamically allocated array of bytes: */
  unsigned char* storage;
} Stash;
void initialize(Stash* S, int Size);
void cleanup(Stash* S);
int add(Stash* S, void* element);
void* fetch(Stash* S, int index);
int count(Stash* S);
void inflate(Stash* S, int increase);
#endif //STASH_H
vim stash.c
/* Error testing macros: */
#include <assert.h>
/* Dynamic memory allocation functions: */
#include <stdlib.h>
#include <string.h> /* memcpy() */
#include <stdio.h>
#include "stash.h"
#define STEP 10
void initialize(Stash* S, int Size) {
  S->size = Size;
  S->quantity = 0;
  S->storage = 0;
  S->next = 0;
}
void cleanup(Stash* S) {
  if(S->storage) {
     puts("freeing storage");
     free(S->storage);
  }
}
int add(Stash* S, void* element) {
  /* enough space left? */
  if(S->next >= S->quantity)
    inflate(S, STEP);
  /* Copy element into storage,
  starting at next empty space: */
  memcpy(&(S->storage[S->next * S->size]),
      element, S->size);
  S->next++;
  return(S->next - 1); /* Index number */
}
void* fetch(Stash* S, int index) {
  if(index >= S->next || index < 0)
    return 0;  /* Not out of bounds? */
  /* Produce pointer to desired element: */
 // return &(S->storage[index * S->size]);
  return (S->storage+index*S->size);
}
int count(Stash* S) {
  /* Number of elements in stash */
  return S->next;
}
void inflate(Stash* S, int increase) {
  void* v =
    realloc


Ïà¹ØÎĵµ£º

cÖеÄÒ°Ö¸Õë

¶ÔÒ°Ö¸ÕëµÄһЩÈÏʶ£º
 
ÎÒ¶ÔÒ°Ö¸ÕëµÄÈÏʶ£¬ÎÒ¾õµÃÒ°Ö¸Õë¾ÍÊÇÒ»¸öÖ¸Õë±äÁ¿ËüÀïÃæµÄÖµÊDz»È·¶¨µÄ£¬ÕâÑùµ±Äã²Ù×÷Õâ¸ö±äÁ¿ËùÖ¸¶¨µÄÄÚ´æµØÖ·µÄʱºò£¬¾Í»á´øÀ´Ò»Ð©²»È·¶¨µÄÒòËØ£¬ÄÃÒ»¸ö±È½Ï³£¼ûµÄÎÊÌâÀ´¾Ù¸öÀý×ÓÀ´ËµÃ÷һϣº
¿´ÏÂÃæ´úÂ룺
 
int a = 10;
int *p;
*p = a;

1.      ......

CÎļþ¶Áд

#include <stdio.h>
#define SIZE 50
int main()
{
FILE *fps=NULL;
fps=fopen("tests.txt","r");
FILE *fpd=NULL;
fpd=fopen("testd.txt","wt+");
fseek(fpd,0,SEEK_END);
char buffer[SIZE];
while (fps || fpd)
{
int t=fread(buffer,sizeof(char),SIZE,fps);
if (t==0)
{
bre ......

¹ØÓÚchar * c="hello"Óëchar c[]="hello"µÄÇø±ð

char * c = "hello"; cÊǸö·ÖÅäÔÚ¶ÑÕ»ÖеÄÒ»¸ö±äÁ¿¡£ÀïÃæ×°µÄÊÇ×Ö·û´®helloµÄÊ×µØÖ·£¬¶øhelloÊdz£Á¿Çø¡£PEÎļþÔÚ±àÒëµÄʱºò¾ÍÈ·¶¨Á˵ġ£
char []c = "hello";
"hello"ÊÇ·ÅÔÚ¶ÑÕ»Öб£´æµÄ£¬¸úÉÏÃæµÄÄǸöÀý×Ó²»Í¬£¬ÓÉÓÚhelloÊǶÑÕ»ÖеÄËùÒÔÊÇ¿ÉÒÔÐ޸ĵġ£¶ø³£Á¿ÇøÀïµÄÊDz»¿ÉÒÔÐ޸ĵġ£ÒòΪPEµÄÄÚ´æÒ³ÊôÐÔÊÇÖ»¶ÁµÄ¡£µ±È»¿ÉÒÔ ......

[CϵÁÐ]C++³ÌÐòÔ±µÍÊÖóðÑÔ1

[CϵÁÐ]C++³ÌÐòÔ±µÍÊÖóðÑÔ1
±à³ÌÒѾ­3ÄêÁË
ÎÒʱ³£¾õµÃ£¬ Èç¹û3ÄêǰµÄÎÒÓÉÏÖÔÚµÄÎÒÀ´Ö¸µãµÄ»°£¬Ó¦¸ÃÓÃ3Ìì¾Í¿ÉÒÔ³öʦÁË¡£
ÎÒµÄÕâÆªÎÄÕ¾ÍÊdzåÕâ¸öÄ¿µÄÀ´µÄ¡£ÔÚ½ÓÏÂÀ´Ô¶Ô¶ÉÙÓÚ3ÌìµÄƪ·ùÖУ¬ÎÒ½«´øÁì¶ÁÕß´Ó²ËÄñÒ»Ö±½úÉýµ½COM(ÒòΪÎÒ×Ô¼ºÒ²Ö»»áÕâô¶àÁË)£¬³õѧÕß¶ÁÍêºó£¬Ó¦µ±Ð¡ÓÐËù³É£¬»ù±¾ÉÏÄÜʤÈÎͨ³£¸÷ÖÖСIT¹«Ë¾µÄ³£¹æ¿ª· ......

delphiµ÷ÓÃVC++6µÄDLL

1¡¢±£Ö¤Äã´«µÝµÄ²ÎÊýÒªÕýÈ·£ºC++ÖеÄchar *¶ÔÓ¦PASCALÖеÄpchar¡£
2£ºC++Öе¼³öµÄº¯ÊýµÄ²ÎÊýµ÷Ó÷½Ê½ÒªºÍÄãDELPHIÖеĵ¼ÈëµÄº¯Êý²ÎÊýµ÷Ó÷½Ê½ÒªÒ»ÖÂ!
 ÀýÈ磺    C++µÄ²ÎÊýµ÷Ó÷½Ê½           ¶ÔÓ¦µÄDELPHIµÄ²ÎÊýµ÷Ó÷½Ê½
           _declspec ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ