C语言复习 --指针表示一个字符串

#include <stdio.h>    
#include <stdlib.h>
 main() 
{  
    char arr[20] ={'h','e','l','l','o','\0'};//char数组表示字符串很麻烦    
    
    // 利用char类型指针 方便的表示一个字符串  
    char* arr1= "hello world";
        
    printf("%s",arr1);    //%s是字符串的占位符   arr1是一个地址 
        
    system("pause");    // 调用windows下系统的命令 让程序暂停执行  方便观察程序的执行结果  
          
          
}

posted @ 2012-11-08 16:49  sfshine  阅读(386)  评论(0编辑  收藏  举报