프로그래밍을 처음 사용하고 다음 기준에 따라 하나의 배열을 다른 배열에 넣는 함수를 작성했습니다. 대상 배열의 변수는 한 번만 반복되고 소스와 대상 배열은 동일하게됩니다 크기.반복 변수를 취소하면서 배열을 다른 배열로 변경하는 방법은 무엇입니까?
int RemoveDup (int src[],int dst[])
//recive two array compare them and copy the src array to dst,and only the none reacuring
//numbers,the arrays must be from the same size
{
int size_src;
int size_dst;
int i,n=0;
size_src = sizeof(src)/sizeof(int);//determine the size of source array
size_dst = sizeof(dst)/sizeof(int);//determine the size of destination array
if (size_src = size_dst);//checks that the array are in the same size
{
for(i = 0;i < size_src;i++)//the loop for advancing the copying process
{
dst[i] = src[i];
}
while (i<size_dst)
{
dst[i] = dst[i++];
if (dst[i] = dst[i++])//relay on the fact that if the function will find a similar varibale, the tested varibale will be set to 0 and the other one will come out clean in the check
dst[i] = 0;//eliminating the varibale in that specific address
}
}
return dst [i];
하지만 일을하고 잘못 가고 아무 생각이없는 것 같다하지 않습니다 내가 생각 해낸 기능입니다. 도움이나 단서가 인정 될 것입니다.
가장 먼저 배울 점은 코드의 들여 쓰기 *입니다. 그렇지 않으면 왼쪽에 줄 지어있는 모든 코드를 읽는 것이 매우 어렵습니다. –
@ david : 작은 도구 모음 아이콘이 편집기에 표시됩니다. '{} '로 표시된 것은 블록을 코드로 렌더링하는데 Anon이 여러분에게 물어 보았던 것입니다. 편집 페이지의 사이드 바에 다른 형식 옵션이 있습니다. – dmckee
이 숙제가 있습니까? – t0mm13b