Anonymous
If myclass1() and myclass2() share inheritance, I think you can do that, else use std::any and std::any_cast
Anonymous
Oh then you can... I think you just did it
Anonymous
Is your code not working
Anonymous
class MyClass1 : public Myclasses try this
Anonymous
Make it public
Anonymous
How did you fix it
Anonymous
Oh okay
Jagadeesh
how to fix this
class Solution{
public:
int MissingNumber(vector<int>& array, int n) {
sort(array.begin(),array.end());
int N=array.back(); //input 1,2,3,5
//output 4
vector<int> vec;
vec.assign(N,0);
for(int i=0;i<vec.size();i++){
vec[array[i]-1]++;
}
for(int i=0;i<vec.size();i++)
if(vec[i]==0)
return i+1;
}
};
this error coming——>Abort signal from abort(3) (SIGABRT)
Abort signal from abort(3) (SIGABRT)
Jasur Fozilov 🐳
Jagadeesh
geeksforgeeks
Anonymous
why gcount is returning 0?
Anonymous
std::fstream file;
file.open(filepath,std::ios::in|std::ios::binary);
std::string buffer;
std::cout << buffer << std::endl;
if(!file){running=false;}
else{
std::streamsize size = file.gcount();
file.clear();
file.seekg(0,file.beg);
std::cout << "size:" << size << std::endl;
file.read(&buffer[0],size);
std::cout << buffer << std::endl;
}
Shahadat Shanto
hello
PHATHUTSHEDZO
Im writting on it i want an easy way to attempt it
Dima
what is this code even
Dima
what are you trying to do with *a=1
Dima
yes, I mean why that way
Dima
nvm lol
klimi
What even is this
printf(" %d ", &A[i]);
klimi
Ah ic
Danya🔥
Do you think it's ok to allocate _Bool and use int*?
Danya🔥
This is very bad code and should not even compile
Danya🔥
It's like you write code in the 70s
Danya🔥
Why.. just why...
Danya🔥
Where do you learn to write such code?
Danya🔥
#cppbookguide
Danya🔥
Use these resources
Danya🔥
@Fo828 the only lesson you should learn is "DO NOT use stupid lessons from YouTube"
\Device\NUL
*(A + 0) = 1
\Device\NUL
You have no NULL handling
\Device\NUL
Accessing or dereferencing NULL pointer is Unknown Behaviour
Anonymous
Anonymous
You should not use %d for printing a pointer. You should use the format specifier %p
Amin
Hi, how can i call back value in linked list function in another function. Example, i collect data from user in addToList(Node *head); and i want to use the data in reverse function. Please anyone help me
A.
Hi
I want help to sort arrays from mimum to maximum
I still bignner
klimi
A.
Can u explain
Anonymous
What is function overloading in c++?
Bobur
Bobur
Danya🔥
Anonymous
Ok I will do it...... thanks you all
Ravindu Ishara
So I am creating a program that calculates the consumption of a car's gasoline and record the odometer with each trip. That part I already have a plan for it, however I ran into a problem where I use a 2D array to hold distances, from and to, in 5 different locations. I am learning headers and I do not know how to declare 2D arrays in a header.
Pavel
Ravindu Ishara
\Device\NUL
*Confused nick young
Vlad
Vlad
Vlad
Yes
Okay lets rephrase it. C xor C++ ? 🤪
Ravindu Ishara
Ravindu Ishara
Ravindu Ishara
Vlad
https://godbolt.org/z/bxbs3oYYT
Vlad
I would have done something akin to this
Vlad
Pay attention to the inline in an array declaration
A
Anybody have experience on sending cookies to libwebsocket for user Authorization
A
Using Qt Cpp
Do
is this possible in C for allocate, or map a specific memory region for application?
Amin
void push(int data)
{
struct Node* newNode;
newNode = malloc(sizeof(newNode)); //here the error
if(newNode == NULL)
{
cout<<"Stack overflow ";
exit(1);
}
newNode->data = data;
newNode->link = NULL;
newNode->link = top;
top = newNode;
}
the error is : invalid conversion from void to node
Amin
hi can someone help me with this
Captain
Captain
Like this struct Node*(malloc())
Pavel
No
If it's in header you can do
inline std::vector<std::vector<int>> distances;
as one of possible variants of declaring it
Leovan
How to find library (glm in my case) which i use in my project on another computer. Idk where user can store it, but I know its installed.
Im tried using CMake but unsuccessfully.
And on Windows not exist /usr/inlcude with all libraries like on Linux.
Is this generally my problem or my project user have to set up environment variables with the libraries I need?
Anonymous
How can windows have Linux libraries 😂,lol
touhou
klimi
Anonymous
OK
Vlad
Vlad
Also there are package managers like conan and vcpkg that do what you just said
Anonymous
😂Mingw and Cygwin,I only used them to configure the vscode environment
Anonymous
but I'm almost on Linux now. I think the interface of Linux is very comfortable
𝕷𝖔𝖗𝖊𝖓𝖟𝖔
Hi guys, when I do an operation like this:
#define PAGE_SIZE (4096);
char *buff= mmap(NULL, 3*PAGE_SIZE,PROT_READ|PROT_WRITE,MAP_SHARED,fd,0);
Does sizeof(buff) == 3*PAGE_SIZE?