提交 964d2710 创建 作者: 宋海霞's avatar 宋海霞

modify

上级 710d6deb
#ifndef SEQSTRING_H_
#define SEQSTRING_H_
//
// Include the C standard library header file here
//
#include <stdio.h>
//
// Other header files are included here
//
//
// Define the data structure here
//
#define MAX_LENGTH 20 // The maximum length of a string
typedef struct {
char data[MAX_LENGTH]; // An array is used to store the characters in a string, and the maximum length of the array is the maximum length of the string.
int nLength; // The actual length of the string, the number of characters in the array.
typedef struct SeqStrElem
{
// An array is used to store the characters in a string,
// and the maximum length of the array is the maximum length of the string.
char data[MAX_LENGTH];
// The actual length of the string, the number of characters in the array.
int nLength;
}SeqString;
//
// Declare the function here
//
int InsertBefore(SeqString* pSource, int pos, SeqString* pTarget);
#endif /* SEQSTRING_H_ */
......@@ -38,7 +38,7 @@ int main(int argc, char* argv[])
InsertBefore(&Source, 4, &Target);
InsertBefore(&Source, 15, &Target); // Failed to insert. The insertion position is invalid.
for(i = 0; i < Source.nLength; i++)
for (i = 0; i < Source.nLength; i++)
{
printf("%c ", Source.data[i]);
}
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论