char * const * (*a) (int b)
char * const * (*a) (int b), 按照c++ program language的读法,从右往左读,* 读作pointer to
把(*a) (int b看作整体,
(*a) (int b) is a pointer to a const pointer to char ,
而a指向的是一个函数,即函数指针
这样就好理解了,
a是一个函数指针,指向这样的一个函数:
参数是int, 返回类型是一个指向const指针的指针, 而这个const 指针指向的是char
例如:
char * const * func(int b) {
string s = to_string(b);
char * str = new char[s.length() + ];
strcpy_s(str, s.length() + ,s.c_str());
char * const pChar = str;
return &pChar;
}
char * const * (*a) (int b) = func;
char *str = *(a());
cout << str << endl; //"123"
char * const * (*a) (int b)的更多相关文章
- C++ char*,const char*,string,int 的相互转换
C++ char*,const char*,string,int 的相互转换 1. string转const char* string s ="abc";const char* ...
- (c++) int 转 string,char*,const char*和string的相互转换
一.int 和string的相互转换 1 int 转化为 string c++ //char *itoa( int value, char *string,int radix); // 原型说明: / ...
- error C2556: 'const char &MyString::operator [](int)' : overloaded function differs only by return type from 'char &MyString::operator [](int)'
char & operator[](int i);const char & operator[](int i);/*const char & operator(int i);* ...
- 【转】char*,const char*和string的相互转换
1. string转const char* string s = "abc"; const char* c_s = s.c_str(); 2. const char*转string ...
- char*,const char*和string的相互转换
好久没写东西啦,发表学术文章一篇,hiahia~ 近日和小佳子编程时遇到很多转换问题,很麻烦,在网上查了很多资料. 为了以后查找方便,特此总结如下. 如果有不对的地方或者有更简单的方法,请指出~~ 1 ...
- 1.C语言关键字(auto break case char const swtich)
ANSI C标准C语言共有32个关键字,分别为: auto break case char const continue default do double else enum extern floa ...
- const char *p;和char * const p的区别
const char *p; const修饰*p,所以*p是一个常量,不可修改. char* const p; const修饰p,所以指针p是一个常量,不可修改. #include< ...
- 深入理解const char*p,char const*p,char *const p,const char **p,char const**p,char *const*p,char**const p
由于没有const*运算,const实际上修饰的是前面的char*,但不能在定义时转换写成 const(char *)*p,因为在定义是"()"是表示函数. 三.深入理解7种组合 ...
- 高德地图引入库错误std::string::find_first_of(char const*, unsigned long, unsigned long) const"
一:std:编译器错误解决 二:错误提示 "std::string::find_first_of(char const*, unsigned long, unsigned long) con ...
随机推荐
- 【批处理】set命令
原文地址:https://www.cnblogs.com/Braveliu/p/5081084.html [1]set命令简介 set,设置. [2]set命令使用 1. 打印系统环境变量.set命令 ...
- D3.js的v5版本入门教程(第八章)—— 坐标轴
D3.js的v5版本入门教程(第八章) D3中没有现成的坐标轴图形,需要我们自己用其他组件拼凑而成.D3中提供了坐标轴组件,使得我们在SVG中绘制一个坐标轴变得像添加一个普通元素那样简单 为了表绘制一 ...
- 单细胞ENS发育数据库
iSyTE 2.0: a database for expression-based gene discovery in the eye - 眼睛发育 StemMapper: a curated ge ...
- Deep High-Resolution Representation Learning for Human Pose Estimation
Deep High-Resolution Representation Learning for Human Pose Estimation 2019-08-30 22:05:59 Paper: CV ...
- Java与.net 关于URL Encode 的区别
在c#中,HttpUtility.UrlEncode("www+mzwu+com")编码结果为www%2bmzwu%2bcom,在和Java开发的平台做对接的时候,对方用用url编 ...
- 子页面赋值给父页面:window.opener.document.getElementById
window.opener 返回的是创建当前窗口的那个父窗口的引用,比如点击了a.htm上的一个链接而打开了b.htm,然后我们打算在b.htm上输入一个值然后赋予a.htm上的一个id为“name” ...
- Python3基础 tuple(list) 改变list元素的内容时,元组的id值不变
Python : 3.7.3 OS : Ubuntu 18.04.2 LTS IDE : pycharm-community-2019.1.3 ...
- Cannot find Makefile. Check your build settings.
QT Cannot find Makefile. Check your build settings. Error while building/deploying project qt_client ...
- DuplicateHandle进程间句柄复制
转载:https://blog.csdn.net/u012372584/article/details/78740365 1. BOOL DuplicateHandle( HANDLE hSo ...
- 【LeetCode算法-38】Count and Say
LeetCode第38题 The count-and-say sequence is the sequence of integers with the first five terms as fol ...