C古典文字列ポインタ


#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(int argc, const char * argv[])
{

    //        
    char a[] = "abcdefg";//       ,   
    char *str = "abcdefg";//      ,    
    printf("%d
"
,sizeof(str));// = 8; printf("%d
"
,strlen(str));// = 7; str = "gBGg"; printf("%d
"
,sizeof(str));// = 8; printf("%d
"
,strlen(str));// = 4; printf("%c
"
,*(str+2));//=G; // for (int i = 0; i < strlen(str); i ++) { printf("%c\t", *(str+i));//g B G g } printf("
"
); char chs[] = "kkkdddfff";// chs[2]='G'; printf("%s
"
,chs); //1 char *p = NULL; p = malloc(100); scanf("%s",p); printf("%s",p); //2 char *pp[100]; scanf("%s",pp); printf("%s",pp); printf("
"
); return 0; }