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

C/C++ qsort()¿ìËÙÅÅÐòµÄÓ÷¨


CÓïÑÔÖÐÅÅÐòµÄËã·¨ÓкܶàÖÖ£¬ÏµÍ³Ò²ÌṩÁËÒ»¸öº¯Êýqsort()¿ÉÒÔʵÏÖ¿ìËÙÅÅÐò¡£Ô­ÐÍÈçÏ£º
void qsort(void *base, size_t nmem, size_t size, int (*comp)(const void *, const void *));
Ëü
¸ù¾ÝcompËùÖ¸ÏòµÄº¯ÊýËùÌṩµÄ˳Ðò¶ÔbaseËùÖ¸ÏòµÄÊý×é½øÐÐÅÅÐò£¬nmemΪ²Î¼ÓÅÅÐòµÄÔªËظöÊý£¬sizeΪÿ¸öÔªËØËùÕ¼µÄ×Ö½ÚÊý¡£Àý ÈçÒª
¶ÔÔªËؽøÐÐÉýÐòÅÅÁУ¬Ôò¶¨ÒåcompËùÖ¸ÏòµÄº¯ÊýΪ£ºÈç¹ûÆäµÚÒ»¸ö²ÎÊý±ÈµÚ¶þ¸ö²ÎÊýС£¬Ôò·µ»ØÒ»¸öСÓÚ0µÄÖµ£¬·´Ö®Ôò·µ»ØÒ»¸ö´óÓÚ0µÄÖµ£¬Èç¹ûÏàµÈ£¬Ôò·µ
»Ø0¡£
Àý£º
#include <stdio.h>
#include <stdlib.h>
int comp(const void *, const void *);
int main(int argc, char *argv[])
{
int i;
int array[] = {6, 8, 2, 9, 1, 0};
qsort(array, 6, sizeof(int), comp);
for (i = 0; i < 6; i ++) {
printf("%d\t", array[i]);
}
printf("\n");
return 0;
}
int comp(const void *p, const void *q)
{
return (*(int *)p - *(int *)q);
}
ÔËÐнá¹ûÈçÏ£º
0 1 2 6 8 9


Ïà¹ØÎĵµ£º

ÓÃCдµÄ3DÃÔ¹¬

          Boss˵£¬Òª¿´OpenGL£¬¿´ÁË¿ìÒ»¸öÔ£¬×ÜËã³öÁ˸öÏñÑùµÄ¶«Î÷£¬ÓÃCдÁ˸ö3DÃÔ¹¬£¬
ËäȻֻÓÐ350ÐÐ
       ´úÂ룬²»¹ý±ßѧ±ßд£¬×ã×ãдÁËÒ»ÖÜʱ¼ä£¬»¹ÊÇСÓгɾ͸еģ¬»î»î»î£¡
         &n ......

C++ÓëC½øÐÐÏ໥º¯Êýµ÷Óã¬extern¹Ø¼ü´ÊµÄÃîÓÃ

   extern³ýÁËÄܹ»ÓÃÓÚÉùÃ÷±äÁ¿£¬ÒѾ­ÔÚÍⲿ±»¶¨Ò壬²»ÓÃÖØж¨ÒåºÍ·ÖÅäÄÚ´æ¿Õ¼ä£¬»¹¿ÉÒÔÔÚC++ÓëC½øÐÐÏ໥º¯Êýµ÷Ó÷½Ãæ»áÓкܴóµÄÓô¦¡£
   Ê×ÏÈ£¬ÎÒÃÇÀ´¿´Ò»Ï£¬ÎªÊ²Ã´C++ºÍCÓïÑÔ²»ÄÜÏ໥½øÐк¯Êýµ÷Óãº
   ±àдÈçϵÄÔ´Îļþ£º
   int func(int i)
{
return 1;
}
&nbs ......

MISRA ×÷Ϊ¹¤Òµ±ê×¼µÄC±à³Ì¹æ·¶

MISRA--×÷Ϊ¹¤Òµ±ê×¼µÄC±à³Ì¹æ·¶(ǶÈëʽc¿ª·¢Õ߱ضÁ)
 
MISRA--×÷Ϊ¹¤Òµ±ê×¼µÄC±à³Ì¹æ·¶
 
  MISRA (The Motor Industry Software Reliability Association
Æû³µ¹¤ÒµÈí¼þ¿É¿¿ÐÔÁª»á)
ÊÇλÓÚÓ¢¹úµÄÒ»¸ö¿ç¹úÆû³µ¹¤ÒµÐ­»á£¬Æä³ÉÔ±°üÀ¨Á˴󲿷ÖÅ·ÃÀÆû³µÉú²úÉÌ¡£ÆäºËÐÄʹÃüÊÇΪÆû³µ¹¤ÒµÌṩ·þÎñºÍЭÖú£¬°ïÖ ......

WindowsÇý¶¯¿ª·¢:ÓÃC»¹ÊÇC++

 ÔÚ×öwindowsÇý¶¯³ÌÐò¿ª·¢Ö®Ç°£¬Ê×ÏÈҪȷ¶¨¿ª·¢µÄÓïÑÔ¡£ÔÚ³£¼ûµÄ±à³ÌÓïÑÔÖУ¬ÎÒÃÇ¿ÉÒÔÑ¡ÔñC¡¢C++¡¢»ã±àÓïÑÔÉõÖÁDelphi¡£²»¹ýÓÉÓÚ
΢ÈíÌṩµÄDDK¿ª·¢»·¾³ËùÌṩµÄÎļþºÍÁ´½ÓÓõĿâÖ»Ö§³ÖCºÍC++ÓïÑÔ¡£ËùÒÔÒ»°ã¶¼²ÉÓÃC»òÕßC++¡£
ʹÓÃCÓïÑÔ£¬ÊDZȽÏÈÝÒ×ÉÏÊÖ£¬ÒòΪºÜ¶àÈ˶¼ÊÇ´ÓѧϰCÓïÑÔ¶øѧϰ³ÌÐò¿ª·¢µÄ£¬¶øÔÚÇý¶¯¿ª·¢µÄ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ