Different way of accessing array elements in C

前端 未结 8 2356
有刺的猬
有刺的猬 2020-11-30 04:49

I am a teaching assistant for a C programming course, and I came across the following line of C code:

char str[] = \"My cat\'s name is Wiggles.\";
printf(\"%         


        
8条回答
  •  感情败类
    2020-11-30 05:33

    Example Code.

    #include
    int main(){
        int arr[] = {1, 2, 3};
        for(int i = 0; i <= 2; i++){
            printf("%d\t", i[arr]);
        }
        return 0;
    }
    

    Output:1 2 3

提交回复
热议问题