indexing - find biggest index of something in c -
I want to type a function that finds the largest index of characters in the string. But when the index has already been received once, it can not return it back.
for example :
word: "hello" character: l
indexet = {};
Expected Return value = 3
When I do this function again:
word: "hello"
Characters: l
indexet = {3} ; Expected return value = 2
Similarly I assign all the spaces for my indexet:
* indexset = (int *) maul (stren -> mutual) * size (int));
In my code, this is enough space for each index of each character. My task is to find the largest index:
int findBiggestIndex (four charts , Four * woord, int * indexset, int * size) {int i = 0, index; (I = 0; i & lt; strlen (woord); i ++) {if (carter == woord [i] & amp;; inArray (index, i, * size)) {index = i; Printf ("% d", * size); Indexset [* size] = index; (* Size) ++; }} Return Index; }
and method inArray ():
#define TRUE 1 # incorrect FALSE 0 int inArray (int * arr, int a, int size) { Int i = 0; For (i = 0; i
The method inArray is also declared before findBiggestIndex so there is no problem. Please help
I want to type the function that finds the largest index of a string string.
If you want to find the last occurrence of a character in the string ... ... compare the loop and the four elements through the string:
something like :
int findLastIndex (char * str, char c) {int keep = 0, i, len; If (str) {len = strlen (str); For (i = 0; i
Therefore, the first argument should see index 7, 14 for the second eb 14
Comments
Post a Comment