char ch[][10]={“ape”,“apple”,“app”};
for(int i=0;i<3;i++)
t1.addword(ch[i]);
in the above code can we write some another termination condition instead of i<3 if we do not know the number of rows?
Termination condition issue
Hello @Rj.25,
It is the optimal condition for the code you have give.
But, in case you don’t know the number of rows, then you can find it and the condition will become i<rows.
To find number of rows:
int rows=sizeof(ch[0])/sizeof(ch);
i.e. the size of first row by the size of the entire matrix.
Hope, this would help.
Give a like if you are satisfied.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.
does the formula u have given for rows is correct? ot it is the reverse?