Hi everyone,
I am writing this function that takes an array and 4 ints as parameters(ros, clos, locx and loc y); It prints out the array accoprding to the number of cols and rows, Now I want it to return the value in the location specified by x and y But I can't figure out how;
Here is what I've done so far, I would appreciate any help I can get. My main question is how do I figure out the index.
Thanks,
#include<stdio.h>
#include"info.h"
Info extract(float* sky,int rows,int cols,int x,int y)
{
int i;
for(i=0;i<rows*cols;i++)
{
printf("%6d\n",sky[i]);
if((i + 1) % cols == 0 && i > 0)
printf("\n");
}
printf("\n");