/******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.
*******************************************************************************/
#include <stdio.h>
float get_value_at(float mat[][4], int id)
{
return mat[id / 4][id % 4];
}
int main(void)
{
float mat[2][4] = {
{1, 2, 3, 4},
{5, 6, 7, 8},
};
float value0 = get_value_at(mat, 5);
printf("%f\n", value0); // Mostrará 6.
float value1 = get_value_at(mat, 0);
printf("%f\n", value1); // Mostrará 1.
return 0;
}