int check(const int a[], int n)
{
while(--n>0 && a[n]==a[0]);
return n!=0;
}
More Related Contents:
- Why is sizeof giving incorrect number of bytes in C++?
- How do I compare chars (or strings) using void functions, also comparing chars that were taken from a struct array
- C++ – Find numbers between first and last negative numbers in Array
- If statement – C++
- How to convert vector to array
- Is std::vector so much slower than plain arrays?
- Address of an array
- How to initialize std::array elegantly if T is not default constructible?
- May I take the address of the one-past-the-end element of an array? [duplicate]
- How to initialize a vector in C++ [duplicate]
- How do I initialize a member array with an initializer_list?
- How do I best handle dynamic multi-dimensional arrays in C/C++?
- Structure of Arrays vs Array of Structures
- Range-based for loop on a dynamic array?
- How to get the real and total length of char * (char array)?
- how to return numpy.array from boost::python?
- The intersection of two sorted arrays
- How do I store arrays in an STL list?
- C++ overloading array operator
- Casting double array to a struct of doubles
- Pointer interconvertibility vs having the same address
- Pointer to array with const qualifier in C & C++
- How does *(&arr + 1) – arr give the length in elements of array arr?
- How does std::end know the end of an array?
- Is std::array movable?
- Pointer to array of unspecified size “(*p)[]” illegal in C++ but legal in C
- c++ expression must have a constant value
- Linear index upper triangular matrix
- Why do we even need the “delete[]” operator?
- Dereferencing one past the end pointer to array type