コンパイルできないこれらの構文エラーを取り除くにはどうすればよいですか?
これは何をしているのか正しい構造を持っていますが、これらのエラーが原因でテストできません。
私はこれをテストすることにとても近づいています。これらのエラーのいくつかを修正するためにint array と int pointer を実行しましたが、次のエラーのある行でそれらを実行しても修正されません。
それはすべて同じタイプのエラーです。
Pointers.c: In function ‘ArrayInitialize’:
Pointers.c:19: error: expected ‘;’ before ‘)’ token
Pointers.c:23: error: expected ‘;’ before ‘)’ token
Pointers.c:25: warning: assignment makes integer from pointer without a cast
Pointers.c: At top level:
Pointers.c:32: error: expected ‘)’ before ‘array’
Pointers.c:44: error: expected ‘)’ before ‘array’
Pointers.c:56: error: expected ‘)’ before ‘array’
Pointers.c:78: error: expected ‘)’ before ‘pointer’
#include <stdio.h>
#include <stdlib.h>
#define SIZE_OF_ARRAY 5
//=============================================================================
int *IntegerPtr;
int ArrayInt[SIZE_OF_ARRAY];
int *ArrayPtr[SIZE_OF_ARRAY];
//-----------------------------------------------------------------------------
void ArrayInitialize(int *array,int *pointer){
int i;
srand(getpid());
for (i =0, i < SIZE_OF_ARRAY; i++;){
array[i] = (int)rand();
for (i =0, i < SIZE_OF_ARRAY; i++;){
pointer[i] = &array[i];
}
}
}
//-----------------------------------------------------------------------------
void ArrayPrint(ArrayInt array){
int i;
for (i =0, int < SIZE_OF_ARRAY; i++;){
printf("%d : %10d \n",i,array[i]);
}
printf("\n");
}
//-----------------------------------------------------------------------------
void ArrayPointerPrint(ArrayInt array){
int i;
for (i =0, i < SIZE_OF_ARRAY; i++){
printf("%d : %10d \n",i,pointer[i]);
}
printf("\n");
}
//-----------------------------------------------------------------------------
void ArrayBubbleSort(ArrayInt array){
int i;
int j;
int temp;
for( i = (SIZE_OF_ARRAY - 1); i >= 0; i-- )
{
for( j = 1; j <= i; j++ )
{
if( *(array+(j-1)) > *(array+j))
{
temp = *array+(j-1));
*array+(j-1)) = array+(j));
*array+(j) = temp;
}
}
}
}
//-----------------------------------------------------------------------------
void PointerBubbleSort(ArrayPtr pointer){
int i;
int j;
int temp;
for( i = (SIZE_OF_ARRAY - 1); i >= 0; i-- )
{
for( j = 1; j <= i; j++ )
{
if( *(pointer+(j-1)) > *(pointer+j))
{
temp = *pointer+(j-1));
*pointer+(j-1)) = pointer+(j));
*pointer+(j) = temp;
}
}
}
}
//-----------------------------------------------------------------------------
int main(void) {
int array[SIZE_OF_ARRAY];
int pointer[SIZE_OF_ARRAY];
ArrayInitialize(array,pointer);
ArrayPrint(array);
PointerBubbleSort(pointer);
ArrayPointerPrint(pointer);
ArrayBubbleSort(array);
ArrayPrint(array);
ArrayPointerPrint(pointer);
return(EXIT_SUCCESS);
}