c ÓïÑÔÖдøconst µÄÖ¸ÕëС¼Ç
Ò»¡¢ÓÐÈçÏ´úÂ룺
int age = 25;
const int *pAge = &age;
ÉÏÃæµÄ´úÂë±íʾ£º
1¡¢Ö¸Õë±äÁ¿pAge´æ·Å±äÁ¿ageµÄµØÖ·£¬ÇÒ²»ÄÜͨ¹ý *pAge = 30£¬À´¸Ä±äÖ¸Õë±äÁ¿pAgeËùÖ¸ÏòµÄ´æ´¢¿Õ¼äµÄÖµ£¬µ«ÊÇ ¶ÔÓÚ age = 30£¬ÔòÊÇûÓÐÎÊÌâµÄ¡£
2¡¢pAge ±¾Éí¿ÉÒÔÔÙ´æ·ÅÆäËü±äÁ¿µÄµØÖ·£¬Ò²¿ÉÒÔÖ¸ÏòNULL£¬Èç pAge = NULL;ÊÇÕýÈ·µÄ¡£
¶þ¡¢ÓÐÈçÏ´úÂ룺
int age = 25;
int *const pAge = &age;
ÉÏÃæµÄ´úÂë±íʾ£º
1¡¢Ö¸Õë±äÁ¿pAgeÓÃconstÏÞ¶¨ÁË£¬ËùÒÔpAge²»ÄÜÔÙ´æ´¢ÆäËü±äÁ¿µÄÖµ£¬Ò²²»ÄÜÖ¸ÏòNULL;ËùÒÔ pAge = NULL;ÊDz»ÕýÈ·µÄ
2¡¢¶ÔÓÚ*page = 30£¬ÊÇÕýÈ·µÄ;
Èý¡¢ÓÐÈçÏ´úÂ룺
int age = 25;
const int *const pAge = &age;
ÉÏÃæµÄ´úÂë±íʾ£º
1¡¢Ö¸Õë±äÁ¿pAge²»ÄÜÔÙ´æ´¢ÆäËü±äÁ¿µÄÖµ»òNULL
2¡¢¶ÔÓÚͨ¹ý*pAge = 30 µÄÐÎʽ¸Ä±äÖ¸Õë±äÁ¿pAgeÖ¸ÏòµÄ´æ´¢¿Õ¼äµÄÖµÊDz»ÕýÈ·µÄ
3¡¢¶ÔÓÚ age = 30 ûÓÐÎÊÌâ
Ïà¹ØÎĵµ£º
CºÍÖ¸Õë
ÔÚCÖÐÓÐÒ»¸öºÜÖØÒªµÄ¸ÅÄ»òÐí´ó¼Ò¶¼ÖªµÀ£¬ÄǾÍÊÇÖ¸Õë¡£Ôںܶà³õѧÕ߸սӴ¥CµÄʱºò¶¼ÈÏΪÕâÊÇ×îÄѵÄ֪ʶµãÁË¡£Ã»´í£¬ÎÒ¸Õ¿ªÊ¼Ñ§µÄʱºòÒ²ÊÇÕâôÏëµÄ£¬ÉÏÁ˵ÚÒ»½Ú¿Îºó£¬µÚÒ»¸ÐÊܾÍÊÇ£ºÌì°¡£¬Õâ¼òÖ±¾ÍÊÇÌìÊ飡ÓÉÓÚ¸öÈ˶ÔÓÚCµÄ°®ºÃ£¬¾¹ýÒ»¶Îʱ¼äµÄѧϰºÍÑо¿Ö®ºó£¬·¢ÏÖÕâÒ»¿éÊÇÎÒ×îϲ»¶µÄ£¬²¢ÇÒÖð²½·¢ÏÖÕâÒ²ÊDZ¾È赀 ......
C/C++
/*
* File: main.cpp
* Author: Vicky
*
* Created on 2010Äê4ÔÂ29ÈÕ, ÉÏÎç9:46
*/
#include <iostream>
using namespace std;
int maximum(int[], int);
int main(int argc, char** argv) {
// int sg[3][4] = {
int sg[][4] = {
{68, 77, 73, 86},
{87, 96, 7 ......
extern cµÄ×÷Óá¾×ª¡¿
2009-12-18 13:10
1.ÒýÑÔ
C++ÓïÑԵĴ´½¨³õÖÔÊÇ“a better C”£¬µ«ÊÇÕâ²¢²»Òâζ×ÅC++ÖÐÀàËÆCÓïÑÔµÄÈ«¾Ö±äÁ¿ºÍº¯ÊýËù²ÉÓõıàÒëºÍÁ¬½Ó·½Ê½ÓëCÓïÑÔÍêÈ«Ïàͬ¡£×÷ΪһÖÖÓûÓëC¼æÈݵÄÓïÑÔ£¬C++±£ÁôÁËÒ»²¿·Ö¹ý³Ì ʽÓïÑÔµÄÌص㣨±»ÊÀÈ˳ÆΪ“²»³¹µ×µØÃæÏò¶ÔÏ󔣩£¬Òò¶øËü¿ÉÒÔ¶¨Òå²»ÊôÓ ......
#include<stdio.h>
#include<malloc.h>
#include<string.h>
/*
* ·×ª
*/
char *mystrrev(char *arr)
{
if (!arr)
{
return NULL;
}
char *temp = arr;
char t;
int leng = strlen(arr) + 1;
int l = (int)(leng / 2);
int i = 0;
while (l--)
{
t = arr[i];
arr[ ......
Ö¸ÕëÊÇC/C++ÓïÑÔµÄÌØÉ«£¬¶øÊý×éÃûÓëÖ¸ÕëÓÐÌ«¶àµÄÏàËÆ£¬ÉõÖÁºÜ¶àʱºò£¬Êý×éÃû¿ÉÒÔ×÷ΪָÕëʹÓá£ÓÚÊǺõ£¬ºÜ¶à³ÌÐòÉè¼ÆÕ߾ͱ»¸ãºýÍ¿ÁË¡£¶øÐí¶àµÄ´óѧÀÏʦ£¬ËûÃÇÔÚCÓïÑԵĽÌѧ¹ý³ÌÖÐÒ²´íÎóµÃ¸øѧÉú½²½â£º"Êý×éÃû¾ÍÊÇÖ¸Õë"¡£ºÜÐÒÔË£¬ÎҵĴóѧÀÏʦ¾ÍÊÇÆäÖÐÖ®Ò»¡£Ê±ÖÁ½ñÈÕ£¬ÎÒÈÕ¸´Ò»ÈյؽøÐÐ×ÅC/C++ÏîÄ¿µÄ¿ª·¢£¬¶øÉí±ß»¹Ò»Ö±³äÂúÕ ......