arrays+functions

Hi!!Hope you guys could help me...
Task:
Write a program that reads in a two-dimensional array representing the coordinates of points in space.
The program should determine the largest absolute value in the array and scale each element of the array by dividing it by this largest value.
The new array, which is called the normalized array, should have the largest value.
The program consists of two functions:
• main() – obtains the number of data points, and the x, y, and z coordinates of each point.
• normalize() – normalize the array.

my incomplete code:

[#include<stdio.h>
#include<stdlib.h>

int normalize(int input[][1], int row, int column);

int main()
{

int row1 = 2;
int column1 = 2;
int z[1][1];
int answer, scale1, scale2, scale3, scale4;

printf("This program is designed to determine the largest absolute value in a\n");
printf("two-dimensional array and scale each element of the array by dividing it\n");
printf("by this largest value.\n\n");

printf("Enter the coordinate of X1:");
scanf("%d",&z[0][0]);

printf("Enter the coordinate of Y1:");
scanf("%d",&z[0][1]);

printf("Enter the coordinate of X2:");
scanf("%d",&z[1][0]);

printf("Enter the coordinate of Y2:");
scanf("%d",&z[1][1]);

answer = normalize(z,row1,column1);

printf("The highest value is %d\n",answer);

scale1 = (z[0][0]) / answer;
scale2 = (z[0][1]) / answer;
scale3 = (z[1][0]) / answer;
scale4 = (z[1][1]) / answer;

printf("Scaled:\n");
printf("Coordinate of X1:%d\n", scale1);
printf("Coordinate of Y1:%d\n", scale2);
printf("Coordinate of X2:%d\n", scale3);
printf("Coordinate of Y2:%d\n", scale4);

system("pause");
return 0;
}

int normalize(int input[][1], int row, int column)

{
int k, l;
int highest = input[0][0];

for( k = 0; k < row; k++)
for( l = 0; l < column; l++)
if ( input[k][l] > highest)
highest = input[k][l];

return highest;
}
] >>>i couldn't get the desired output..hope anyone could help me to correct the mistake..tq,,,
Topic archived. No new replies allowed.