qfedu-c-level/day10/d10.c

25 lines
610 B
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include <stdio.h>
void show(char *q[], int n)
// void show(char **q, int n) // char **q == char *q[]
{
for (int i = 0; i < n; i++)
{
while (*(*(q + i))) // 当本行字符串没有结束时
{
printf("%c", *(*(q + i))++); // q[i] == *(q + i)
}
printf("\n");
}
}
int main()
{
// names 内容存在栈区names[0] 存放的是字符串的首地址
// "disen" 是常量,存在常量区,"disen" 的首地址存在栈区
// 常量区的内容不能修改
char *names[3] = {"disen", "rose", "jack"};
show(names, 3);
return 0;
}