Hi guys!
I have a problem with numeric_limits class. My VS Code recognise “numeric_limits” as undefined identifier instead of a class and size() is not working in my VS Code as well. How to solve this problem?
size() issue:
Hi guys!
I have a problem with numeric_limits class. My VS Code recognise “numeric_limits” as undefined identifier instead of a class and size() is not working in my VS Code as well. How to solve this problem?
size() issue:
std::numeric_limits
, include <limits>
header file.std::size
, include one that fits.what should I include for std::size ?
i didn’t understand your suggestion for size function
std::size
has multiple implementations in different classes. It is a method (class-only function) and not a normal (common) function.
Got it buddy, Thank you!
Here, check this answer:
My compiler version is C++17 and it is still not getting compiled after adding <iterator>
headerfile as you suggested,buddy.
MyCode
#include<iostream>
#include<iterator>
using namespace std;
void printNumbers(int numbers[],int size);
int main(){
int numbers[]= {10,20,30};
printNumbers(numbers,size(numbers));
return 0;
}
void printNumbers(int numbers[],int size){
for(int i=0; i<size; i++)
cout<< numbers[i] << endl;
}
Look at the terminal window, it still states that " ‘size’ was not declared in this scope
printNumbers(numbers,size(numbers));" after compiling my source code!
Try this: