Wendy
Dima why
Wendy
Here
Yeah
Anonymous
Yeah
That's why
Anonymous
Yeah
You made a syntax error
Wendy
🆗
Anonymous
🆗
Alongside semantic
Jaspreet
Hello
Jaspreet
How to read header files in c language plz
Jaspreet
Like math.h stdio.h conio.h String.h signal.h and so on plz help
Jaspreet
I know you all are genius ☺️
Daniel
Like math.h stdio.h conio.h String.h signal.h and so on plz help
Could you define the problem more specifically? Do #include <math.h> directives work? Or you have some troubles with not found files? Judging by your need for conio.h you're on windows, reading some windows guides? What is your setup (IDE/Compiler)?
Jaspreet
I want to read the header file
Jaspreet
Or see inside the header file
Jaspreet
Plz help
Daniel
I want to read the header file
Ah, I see. You need to discover your include path, where the headers are installed on your system. On *nix it's usually /usr/include. I don't know the path on Windows though. You can open and read the include files there.
Jaspreet
Thank ☺️☺️
Jalal
Hello, anyone can tell me this code is correct? Or can I use print() in inherit class without writing virtual or override? is it now overriden or not? thnx class Base { public: virtual void print() = 0; }; class inhert : public Base { public: void print() {} };
Alex
yes, it is overriden
The Shadow Monarch
If we have to add floats to the program... We need to add #include[floats.h] command right?
Wendy
Does anyone know how to create a keylogger
olli
Hello, anyone can tell me this code is correct? Or can I use print() in inherit class without writing virtual or override? is it now overriden or not? thnx class Base { public: virtual void print() = 0; }; class inhert : public Base { public: void print() {} };
I would further suggest to add override (supported since C++11) which can help preventing bugs e.g. class Base { public: virtual void print() = 0; }; class inhert : public Base { public: void print() override {} };
Jalal
I would further suggest to add override (supported since C++11) which can help preventing bugs e.g. class Base { public: virtual void print() = 0; }; class inhert : public Base { public: void print() override {} };
Thanks, If I dont write override, then Print() belongs to which class? and can you please explain what happens if I write virtual instead of override?
olli
Thanks, If I dont write override, then Print() belongs to which class? and can you please explain what happens if I write virtual instead of override?
you need virtual to be able to override the member function. override makes sure you actually do override it.
Jalal
Thank you guys
dj
#include <stdio.h> int main(void) { int a = 010; printf("%d",a); return 0; } how this prints 8 ?
Alex
yes
dj
010 is 8. remove leading zero. leading zero means 8-based system
oh so if there is leading zero always 8-based number systemis used ?
Alex
yes
dj
yes
oh someone said to me it would be 2 or 10 depending on the compiler
Alex
https://en.cppreference.com/w/cpp/language/integer_literal
Alex
no
dj
no
https://www.tutorialspoint.com/cprogramming/c_constants.htm so it is like this in c also if 0 is followed by digits its taken as octal
dj
thanks i got it if starting number is 0 followed by trailing numbers(digits), it will be converted to octal
tasty
tasty
why should we initiate *c?
tasty
in the function getLargestRadius?
Pavel
in the function getLargestRadius?
we can do that in the line above as well, and then the check will be if (c != nullptr), but this form with initialization in an if statement is sometimes better because you reduce the scope of the variable and can't accidentally access it later. So it's more safe in general, but in this case there's no difference
Pavel
or you are asking about something different?
tasty
thank you
𝕽𝖆𝖒
I have started learning the C/C++ language, please provide as much information as possible. Thank you.
Emir
Where is my mistake?
Emir
Where is my mistake?
I get a linker error
Emir
And this is my main.cpp #include "stack.hpp" int main() { Stack<int> entity; entity.push(20); }
Anonymous
You shouldn't split template declaration and definition into header and source files
Anonymous
Everything has to be written in header files
Emir
You shouldn't split template declaration and definition into header and source files
So i got it, but why just 2 functions of Stack class couldn't be linked. Why other functions are linked successfully
Anonymous
Because you call only two functions
Emir
Because you call only two functions
You're right okay, my mistake
Anonymous
Just move all the code into header files and that's it
Anonymous
https://pastebin.com/MT37XnMZ Is it possible to make it more efficient??I'm new to coding..
𝕽𝖆𝖒
C and C++ are two different languages
Sorry sir, I just want to learn c language.
𝕽𝖆𝖒
Why?
Learn programming
Anonymous
Ok
Andrew
guys what is the diffrence between using new and malloc ?
Pavel
guys what is the diffrence between using new and malloc ?
malloc gives you some amount of allocated memory, new gives you a dynamically allocated object (allocates memory + calls the constructor). Basically malloc of a correct amount of memory + "placement new" in this memory will achieve the same result as new. But new is not guaranteed to be implemented this way by the standard so in the described situation this memory should be still destructed by calling the destructor on the memory and then free. What I want to say, that malloc-free and new-delete should not be mixed in any case.
Andrew
ok, i get new add the constructor, but you cant use free
Andrew
thanks
Jasur Fozilov 🐳
What is the difference between a mathematical mode and a mode in programming?
Anonymous
hello , i have some questtions in c , sorry to interupt : student * student1 = (* student) malloc (sizeof (student); at. What type of return does the malloc function return? b. What is the word (* student) for?
Anonymous
How dare you?
Anonymous
i am sorry XD
Anonymous
ELIMINATION
Anonymous
vinícius*
hello , i have some questtions in c , sorry to interupt : student * student1 = (* student) malloc (sizeof (student); at. What type of return does the malloc function return? b. What is the word (* student) for?
a. malloc always returns a void *. b. (student *) casts the void * into a student *. This happens automatically in C but needs to be explicit in C++.
Anonymous
hello , i have some questtions in c , sorry to interupt : student * student1 = (* student) malloc (sizeof (student); at. What type of return does the malloc function return? b. What is the word (* student) for?
By default malloc(3) return void *. In your case it will return student * because you wrote ( * student). That's often used in C++ code with C memory allocators, which is wrong, to silence warnings from cpp compiler
Anonymous
If you write in C use malloc(), if you write in C++ use new, but in C++ you can avoid using pointers and new
Anonymous
❤️❤️❤️❤️❤️thank you all ❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️ i wich you the best in every part of your lives ^^ 😍😍😍😍😍😍😍😍😍