编程实现一个由7个元素组成的整数数组,存放在主存的连续存储单元中,数组的起始地址为AS。AS{31h,36h,33h,32h,38h,37h,35h}1. 编程实现:将数组AS中的元素向右循环移动一个位置,例如移位后变成{35h,31h,36h,33h,32h,38h,37h}2. 编程实现:将AS中最大元素和最小元素分别存于Max和Min中3. 将字符串AS中的内容复制到target中,并显示输出
时间: 2023-07-15 20:11:21 浏览: 89
1.
```c
#include <stdio.h>
int main() {
int AS[] = {0x31, 0x36, 0x33, 0x32, 0x38, 0x37, 0x35};
int temp = AS[6];
for (int i = 6; i > 0; i--) {
AS[i] = AS[i - 1];
}
AS[0] = temp;
for (int i = 0; i < 7; i++) {
printf("%x ", AS[i]);
}
return 0;
}
```
2.
```c
#include <stdio.h>
int main() {
int AS[] = {0x31, 0x36, 0x33, 0x32, 0x38, 0x37, 0x35};
int min = AS[0], max = AS[0];
for (int i = 1; i < 7; i++) {
if (AS[i] > max) {
max = AS[i];
}
if (AS[i] < min) {
min = AS[i];
}
}
printf("Max: %x\n", max);
printf("Min: %x\n", min);
return 0;
}
```
3.
```c
#include <stdio.h>
#include <string.h>
int main() {
char AS[] = {0x31, 0x36, 0x33, 0x32, 0x38, 0x37, 0x35, '\0'};
char target[8];
strcpy(target, AS);
printf("%s", target);
return 0;
}
```
阅读全文