#include<stdio.h>
#include<stdlib.h>
#define uchar unsigned char
#define uint unsigned int
void display(uchar *p);
char h[4] = {'A','B','C','\0'};
char e[4] = {'E','F','L','\0'};
char l[4] = {'M','N','O','\0'};
char o[4] = {'X','Y','Z','\0'};
int main(void)
{
int i;
char c;
uint set[5];
set[0] = h;
set[1] = e;
set[2] = l;
set[3] = l;
set[4] = o;
while(1){
for (i = 0; i < 5; ++i){
display(set[i]);
printf("\n");
sleep(1);
void display(uchar *p)
{
while(*p != '\0'){
printf("%c", *p);
printf("%c", *(p+1));
++p;
}
}
#include<stdio.h>
#include<stdlib.h>
#define uchar unsigned char
#define uint unsigned int
void display(uchar *p);
char h[4] = {'A','B','C','\0'};
char e[4] = {'E','F','L','\0'};
char l[4] = {'M','N','O','\0'};
char o[4] = {'X','Y','Z','\0'};
int main(void)
{
int i;
char c;
int set[5];
set[0] =(int) h;
set[1] =(int) e;
set[2] =(int) l;
set[3] =(int) l;
set[4] =(int) o;
while(1){
for (i = 0; i < 5; ++i){
display((uchar *)set[i]);
printf("\n");
sleep(1);
void display(uchar *p)
{
while(*p != '\0'){
printf("%c", *p);
printf("%c", *(p+1));
++p;
}
}
在字模数组的首地址赋值方面用了强制转换为int.在函数调用方面.因为子函数中要求到输入为指针,所以在前面的调用时候,不能单纯的写set[i].而是传指针过去.(uchar *)的强制类型转换是为了配合(uchar *p).