const void *a
这是定义了一个指针a,a可以指向任意类型的值,但它指向的值必须是常量。
在这种情况下,我们不能修改被指向的对象,但可以使指针指向其他对象。
例如:
const void *a;*a=0x123;//是编译通不过的,因为*a中放的是个const值。const值是不能被改变的。
const int m=1; const int n=2;
a=&m; a=&n;//编译可以通过。
void* const a
这是定义了一个const指针a,a可以指向任意类型的值,但a是指向某个对象的常量指针。
我们不能修改指针中存储的地址,但可以修改指针指向的对象。
例如:
void* const a;这个定义:*a=0x123;是没问题的,
但是a=(void*)&b;是不行的,因为a是const变量。
如:
int m=1; nt n=2;
a=&m; a=&n;//编译不成功。
可以这么说,const void *a;中const修饰的是*a。在void* const a中,const 修饰的是a。
原文:
http://blog.csdn.net/yinjiabin/article/details/6731352
分享到:
相关推荐
水仙花c语言#include #include void main() /*主函数*/ { int num, a,b,c; /* 定义a,b,c为整形函数 */ for(a=1;a;a++) /*a是百位上数字,范围是1~9*/
ssize_t send(int, const void *, size_t, int) __DARWIN_ALIAS_C(send); // void * 万能指针 // 读取数据 ssize_t recv(int, void *, size_t, int) __DARWIN_ALIAS_C(recv); // 关闭连接 int close(int);
能够按照格式化输出字符串数据,长度不受限制,亲测十几兆都正常。 #include using namespace std;
long __stdcall RFCFileWrite(void* AFile, const void* ABuffer, long ASize); // 文件定位/清除文件缓存/设置文件末尾 long __stdcall RFCFileSeek(void* AFile, long* AOffset, long AOrigin); long __stdcall ...
int __cdecl sort(const void* a, const void* b); }; class Test { public: std::vector<int> mm; void Sort(int (*comp)(const void *,const void *)) { return qsort(mm._Myfirst,mm.size(),sizeof(int),...
void* memcpy(void* destination, const void* source, size_t num); void* dest 目标内存 const void* src 源内存 size_t num 字节个数 库中实现的memcpy函数 struct { char name[40]; int age; } person, ...
3、memcpy() 函数: void *memcpy(void *destination, const void *source, size_t num) 该函数将一块内存区域的内容复制到另一块内存区域。参数 destination 是目标内存区域的指针,source 是源内存区域的指针,num...
int compare (const void * a, const void * b) { return (*(int*)a - *(int*)b ); } char inputbuffer[1001]; int front; int length; void InitQueue(void) { length=strlen(inputbuffer); front=length-1; } ...
c++,const,描述const关键字在c++中的用法。
从变量到常量的赋值是合法C++的语法约定的, 如从char 到const char顺畅; 但从char **到 const char **编译器就会... const char b = a; char * a2 = 12345; const char * b2 = a2; char** a3 = NULL; //const
~ftpclient(void); int connect(const char* addr, short port); int disconnect(); int login(const char* username, const char* passwd); int get(const char* remotefile, const char* localfile); int ...
函数名称: qsort <br>函数原型: void qsort(void *base, size_t nelem, size_t width, int (*fcmp)(const void *,const void *) <br>函数功能: 使用C.A.R.Hoare排序法对数组base进行排序 <br>函数返回: ...
void __stdcall SendFetionSMSA(const CHAR* tszUserName,const CHAR* tszPass,const CHAR* tszSendTo,const CHAR* tszMsg); void __stdcall SendFetionSMSA(const CHAR* tszUserName,const CHAR* tszPass,const ...
void WriteEx(const void* lpBuf, DWORD dwCount); void TransmitChar(char cChar); void GetOverlappedResult(OVERLAPPED& overlapped, DWORD& dwBytesTransferred, BOOL bWait); void CancelIo(); //...
void (*write_replacement) (const unsigned int *buf, size_t buflen, void* callback_arg), void* callback_arg, void* data); /* Fallback function. Invoked when a Unicode character could not be ...
void SetMode(byteint A,byteint B,byteint C,byteint D);//C=A%B int PowerMode(byteint A,byteint C,byteint D,signed char flag[400]);//computing A^B mod C-->D void IntRandom(byteint RandomA,int num);...
static bool UnZip( const char* filename, const char* dstfolder, bool ingorepath = false, const char* password = NULL); bool OpenUnZipFile(const char* filename); bool CloseUnZipFile(&#...
ios下面的AES加解密库 @interface NSData (AESCrypt) ...- (BOOL)hasPrefixBytes:(const void *)prefix length:(NSUInteger)length; - (BOOL)hasSuffixBytes:(const void *)suffix length:(NSUInteger)length; @end
void AddHeader(const char* lpszName, const char* lpszValue); void ClearCookies(); void AddCookie(const char* lpszName, const char* lpszValue); void ClearPostArgs(); void AddPostArg(const char* ...
void writeFile(const char *filename); double* getMultiVarMarked(const char *mark,int n); double getVarMarked(const char *mark); void getFile(const char *fileName); void getStrMarked(char* dest,...