Day.01.08ポインタ配列と文字列

910 ワード

#include 
#include //strcpy         ,         

int main(int argc, const char * argv[]) {
    // insert code here...
    //         1
    char hello [7] = "hellos";
    
    char *p = hello;
    
    printf("%c
",*(p+1)); // 2 //char *p1 = "hello";// char *p1 = hello;// char hello [7] printf("%c
",*(p1+4)); printf("p1 = %s
",p1); strcpy(p1, "zhake");// , , printf("p1 = %s
",p1); char array [11] = "helloworld"; char array1 [11]; for (int i = 0; i < 10; i++) { array1 [9 - i] = array [i];// array1 i < 11 array1 [i] = array [i] } printf("%s
",array1); return 0; }