0

How can function return unsigned long long value?

https://code.sololearn.com/cceSw7HC7r98/?ref=app From numbers in vector program shall output min value without repeating elements.

7th Oct 2021, 6:12 PM
TeaserCode
2 Respuestas
+ 3
The issue was caused by an incorrect initialization as well as condition in the last for loop. This fixed version should be working: https://code.sololearn.com/cSyL5I8fhn68/?ref=app You can shorten your function by making use of the STL, which predefines algorithms for sorting and removing consecutive duplicate values: https://code.sololearn.com/clc3Q63wbK5H/?ref=app Eashan Morajkar Not sure what your source for that statement is, but both C and C++ have a `long long` integral type modifier (as of C99 and C++11, respectively). The type is not an issue here. See: https://en.cppreference.com/w/cpp/language/types https://en.cppreference.com/w/c/language/arithmetic_types
7th Oct 2021, 8:10 PM
Shadow
Shadow - avatar
- 3
You cannot return a unsigned long long because such type doesn't exist, the unsigned can hold 4 bytes of positive numbers which can contain 4,294,967,296, adding a long after unsigned doesn't make it increase its size, to store more values that unsigned you will need to use two variables or more
7th Oct 2021, 6:22 PM
Eashan Morajkar
Eashan Morajkar - avatar