#define _CRT_SECURE_NO_WARNINGS // 这句话一定要写在开头第一行才有效果
#include <stdio.h>
#include <string.h>
int* findGG(char tempGG[1001]);
int main()
{
char temp[1001] = { "AGTGACGCAGAGGCTGGAGACGACTCTACGGCGGCGAAGAGACGCGGGTTGAGGAAGAGGGACGGATTGC" };
int* p1; //虽然定义的GGlocation数组是静态局部变量,但是返回的GGlocation在main()中是不可调用的,因此使用一个int* p1指针指向该静态局部变量,实现调用。
p1 = findGG(temp);
printf("'%d'\n", p1[0]);
return 0;
}
int* findGG(char tempGG[1001])//寻找目标字符串中的连续的GG字符的位置
{
int i = 20;
int j = 0;
static int GGlocation[1001] = {0};
while (tempGG[i] != 0)
{
if (tempGG[i] == 'G' || tempGG[i] == 'g')
{
if (tempGG[i+1] == 'G' || tempGG[i+1] == &