现在的位置: 首页 > 综合 > 正文

C++ char* char a[] string叛空

2018年02月03日 ⁄ 综合 ⁄ 共 375字 ⁄ 字号 评论关闭

char* char a[]

#include <iostream.h>
#include <string.h>

int main()
{
 char ch[]="book";
 char *p="";
 
 int len1,len2;
 len1=strlen(ch);
 if(len1!=0)
  cout<<" \nnot null.";
  else
  cout<<"\n is null";
  
 len2=strlen(p);
  if(len2!=0)
   cout<<"\nnot null.";
  else
  cout<<"\n is null";
  
  return 0;
}

string

string a;
if(a.empty())
{
    cout<<"空"<<endl;
}
if(a.length()==0)
{
    cout<<"空"<<endl;
}

CString

CString a;
if(a.GetLength()<=0)
{
        cout<<"空"<<endl;
}

抱歉!评论已关闭.