how to print a specific number in the array? Like for my program I have to calculate the cost of 5 companies in 4 years. For the last function how do I let say print the total cost of company 1.
Code:
#include <stdio.h>
void getvalues();
double totalcost(float);
void main()
{
getvalues();
y=double totalcost(cost);
}
void getvalues()
{
float cost[5][6];
int i,y,com=0,year=0;
for(i=0;i<5;i++)
{
for(y=0;y<4;y++)
{
com=i+1;
year=y+1;
printf("Please enter the electricity cost for Company %d, year %d:",com,year);
scanf("%f",&cost[i][y]);
}
}
}
double totalcost(float c)
{
int selection;
printf("Please enter the number of company");
scanf("%d",selection);