I need to add the numbers in the row array mentioned in the structure. for example I need the output of row=[ 4 5 6] and age= 25, how can i do with the above mentioned structure?? Please help !
Based on this update:
Put the number of elements you want to store into the array defination:
int row[1]; // This stores 1 element of type int
// you want to store 3 elements: 4, 5, 6, so...
int row[3]; // This is what you're looking for
Remember an array:
int row[X];
Goes from row[0]
to row[X-1]
. So in your case X=3
that means your min/max values for your array are:
min = row[0]
max = row[3-1] = row[2]
That means your code should do something like:
pptr->row[0] = 4;
pptr->row[1] = 5;
pptr->row[2] = 6;
pptr->age = 25;
printf("%d\n",pptr->row[0]);
printf("%d\n",pptr->row[1]);
printf("%d\n",pptr->row[2]);
printf("%d\n",pptr->age);
3
solved I am a beginner in C, could anybody please help me with the output [closed]