今日学习任务 |
指针,指针与字符、字符串、数组,指针数组 |
今日任务完成情况 (详细说明本日任务是否按 计划完成,开发的代码量) |
了解了什么是指针,以及指针的基本用法与应用;将指针与之前所学的字符、字符串、数组结合,对以上用法与应用有了更深刻的认识;复习了之前所学的指针数组,加深了对其认识 |
今日开发中出现的问题汇总 |
思考(*p1)++,*p1++之间的区别。 利用指针运算实现库函数strcpy。 |
今日未解决问题 | 无 |
今日开发收获 | 积累了一些经典程序,巩固了之前所学的知识点,加深了自己对指针的理解 |
自我评价 | 学习效率提高了 |
其他 | 无 |
作业:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <string.h>
#include <stdlib.h>
int main()
{
char *str[] = { "I", "am","from","shanghai" ,NULL};
int i = 0;
int j = 0;
int len = 0;
char *temp;
while (str[i] != NULL)
{
i++;
len++;
}
for(i = 0, j = len - 1; j > i; i++,j--)
{
temp =*(str+i);
*(str+i) = *(str+j);
*(str+j) = temp;
}
for(i = 0; i < len; i++)
{
printf("%s ", *(str+i));
}
printf("\n");
{
char *str[] = { "I", "am","from","shanghai" ,NULL};
int i = 0;
int j = 0;
int len = 0;
char *temp;
while (str[i] != NULL)
{
i++;
len++;
}
for(i = 0, j = len - 1; j > i; i++,j--)
{
temp =*(str+i);
*(str+i) = *(str+j);
*(str+j) = temp;
}
for(i = 0; i < len; i++)
{
printf("%s ", *(str+i));
}
printf("\n");
return 0;
}
}