I am struggling with understanding functions. Here's what I have.#include <stdio.h>
Expand|Select|Wrap|Line Numbers
- void row (int);
- int main (void)
- {
- int x=41;
- int i;
- for (i=1; i<=x; i+=10)
- printf("%d",i);
- row (int j);
- }
- void row(int j)
- {
- int j;
- for (j=1;j<=41;j++)
- printf("%d",j);
- return 0;
- }
1 2 3 .... 10
11 12 13 .....20
21 22 23 .....30 up to 50.
I have to use a function.
I am trying to print the first column value,(i) pass it to the function,(row (int j)) add 1 to the value (i) (9 times) and then go back to main for my next value (i) wich will be 11 and so on.
Is this the correct approach? I've been at it for awhile now with no luck.