typedef字符型指针的字符串使用

来源:互联网 发布:淘宝绑定别人的银行卡 编辑:程序博客网 时间:2024/05/17 04:47

刚来报到,刚接触编程时不会使用字符串,发现字符char的指针能指示字符串。纪念我的编程时代的开始~

int main(){     typedef char *pstring;     const pstring cstr = "abcd";     const pstring *ps = &cstr;     decltype (cstr) ci ="efgh";     std::cout << cstr[2] << ","<< *ps <<","<< ci<< std::endl;     system("pause");     return 0;}

0 0
原创粉丝点击