Judging if an array is ascendingin a recursion way
2013-08-18 15:12
381 查看
int b[8] = {'3','2','3','4','5','6','7','8'}; int isAsc(int* b, int len){ if(len == 0){ return 1; } if(b[len] >= b[len-1]){ return isAsc(b,len-1); }else{ return -1; } } int main(){ int result = isAsc(b,7); printf("%d", result); getchar(); }
相关文章推荐
- Given an array of size N in which every number is between 1 and N, determine if there are any dupli
- How do you check if a variable is an array in JavaScript? [duplicate]
- Ten Ways to Check if an Integer Is a Power Of Two in C
- Finding all elements(which are integer) in an array whose sum is equals to the element exists within
- CareerCup Sort an array in a special way
- NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.
- error : A file found in a source-path must have an externally visible definition. If a definition in the file is meant to be ext
- Simple way to check if an image bitmap is blur
- CareerCup Find if an array is a sequence
- Best Way to Loop Through an Array in JavaScript
- Test if a given element name exists in an array Tcl tk
- What is the fastest, case insensitive, way to see if a string contains another string in C#?
- (NOT CLEAR)Question 40: In the declaration below, p is a pointer to an array of 5 int pointers:
- Judging wether a specific number is in the array using JavaScript
- spring webservice 搭建出现的异常处理。异常: NAMESPACE_ERR: An attempt is made to create or change an object in a way whi
- Checking if an array contains a value in C#
- How to Check if an Array Contains a Value in Java Efficiently?---reference
- Is there a way to add a badge to an application icon in Android?
- Whats the best way to split an array in ruby into multiple smaller arrays of random size
- Is there a way to add a badge to an application icon in Android?