Here i am posting again the program for creating the table of contents which are filled according to the user with dynamic arrays but yet the problem regarding the output is not solved ,i know dry run is correct , compilation is free from errors and warnings,builtable() function is working correct but following functions are giving undesired result.

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

int**buildtable(void);
void filltable(int**table);
void processtable(int**table);
int smaller(int first,int second);
int larger(int first,int second);
int rowMinimum(int*rowPtr);
int rowMaximum (int*rowPtr);
float rowAvg(int*rowPtr);

/*Function declaration*/

int main()
{
int**table;
table=buildtable();
filltable(table);
processtable(table);
return 0;
}

int**buildtable()
{int rowNum;
int colNum;
int**table;
int row;
printf("\nEnter the number of rows in the table:");
scanf("%d",&rowNum);
table=(int**) calloc(rowNum+1,sizeof(int*));
for(row=0;row<rowNum;row++)
{
printf("Enter the no of integer in row%d",row+1);
scanf("%d",&colNum);
table[row]=(int*)calloc(colNum+1,sizeof(int));
table[row][0]=colNum;
}
table[row]=NULL;
return table;
}


void filltable(int**table)
{
int row=0;
int column;
printf("\nNow we fill the table\n");
printf("\nFor each row enter the data");
printf("\nand press return:");

while(table[row]!=NULL)
{
printf("\n row %d(%d integers)===>",row+1,table[row][0]);
for ( column=1;column<=*table[row];column++);
scanf("%d",table[row]+column);
row++;
}

/*Here only one input is taken by the user but it should be according to the "*table[row]"*/

return;
}


void processtable(int** table)
{int row =0,rowMax,rowMin;
float ravg;
while(table[row]!=NULL)
{
rowMin=rowMinimum(table[row]);
rowMax=rowMaximum(table[row]);
ravg=rowAvg(table[row]);
printf("\nThe statistics for row%d",row+1);
printf("\nThe minimum:%5d",rowMin);
printf("\nThe maximum:%5d",rowMax);
printf("\nThe avg.:%8.2f",ravg);
row++;
}
}

int rowMinimum (int*rowPtr)
{
int rowMin =INT_MAX,column;

printf("\nINT_MAX:",rowMin);

Here no INT_MAX value is printed by the compiler instead of including<limits.h>

for(column=1;column<=*rowPtr;column++)
{
rowMin=smaller(rowMin,*(rowPtr+column));
}return rowMin;
}

int rowMaximum(int*rowPtr)
{
int rowMax=INT_MIN,column;

printf("\nINT_MIN:",rowMax);

/*Same here*/

for(column=1;column<=*rowPtr;column++)
rowMax=larger(rowMax,*(rowPtr+column));
return rowMax;
}

float rowAvg(int*rowPtr)
{
float total=0;
float ravg; int column;
for(column=1;column<=*rowPtr;column++)
total+=(float)*(rowPtr+column);
ravg=total/ *rowPtr;
return ravg;
}

/*Here this part recieves "*rowPtr" from table[row]
which seems to be correct:-O even than output is "0.00"

int smaller(int first,int second)
{
return(first<second ? first:second);
}
int larger (int first,int second)
{
return(first>second?first:second);
}

The problem in filltable method :
for ( column=1;column <= *(table[row]);column++); //remove the semicolon :)

commented: Yes! +13

Thank x a lot:cool:
===============
SMALL THINGS DO CREATE BIG PROBLEMS:$

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.