Sylvester Lim
Hi all, can anyone explain what <Type> means in c++ codes?
Konstantin
Hi all, can anyone explain what <Type> means in c++ codes?
https://www.geeksforgeeks.org/templates-cpp/
Grigoriy
Hello. How std::copy behaves with overlapping memory ranges?
Pavel
Hello. How std::copy behaves with overlapping memory ranges?
https://en.cppreference.com/w/cpp/algorithm/copy > When copying overlapping ranges, std::copy is appropriate when copying to the left (beginning of the destination range is outside the source range) while std::copy_backward is appropriate when copying to the right (end of the destination range is outside the source range).
Chat Boss
Anikalp Jaiswal sent a code, it has been re-uploaded as a file
...
can someone please help me out why this code doesn't work for binary to decimal conversion?
...
according to me, I am logically right
\Device\NUL
can someone please help me out why this code doesn't work for binary to decimal conversion?
std::string is array of char and not array of int. ASCII char is represented as integer but that's not how you play the game
\Device\NUL
according to me, I am logically right
Wrong, You get the ASCII Value
...
oh okayy, I got it
\Device\NUL
'1' with 1 is different
...
this group is pretty helpful thanks
Pavel
oh okayy, I got it
You probably can also use left shift << instead of pow
...
okay doing it
Chat Boss
Kriss Ny sent a code, it has been re-uploaded as a file
Kriss
Kriss Ny sent a code, it has been re-uploaded as a file
i want to print the value which don't have next greater element using stack but my code doesn't gives any output, what i am doing wrong ?
Kriss
What are you trying to do?
I want to print the value which don' t have next greater element , for ex- v={2, 5, 8, 9, 3, 5}, i want to print 9 and 5
\Device\NUL
Kriss
I want to print the element which don't have next greater element using stacks😭
\Device\NUL
You will get out of bound
\Device\NUL
The iteration sholud use for loop and not range based for loop
Mr
Yea I didn't noticed That was a stack
Peter The Great
Hello
Mr
Hello
No hello Rule #2
Kriss
Which link
https://www.geeksforgeeks.org/next-greater-element/
Mr
https://www.geeksforgeeks.org/next-greater-element/
You want same thing but for stack right?
Mr
I can do for linked list
Mr
i will try doing this
Did you used array for creating stack or linked list
Kriss
Did you used array for creating stack or linked list
🫠 i ain't created the stack, isn't its inbuild, i am just doing this exercise to learn about stack
Mr
Except for last element
\Device\NUL
Except for last element
for (size_t i = 0; i < vec.size() - 1; i++)
Anonymous
Hey guys can you tell me how to become more proficient in this language im trying hard but some times its really tough
Thadeu
Hey guys can you tell me how to become more proficient in this language im trying hard but some times its really tough
Focus on pointers, references, memory allocation and pointer math, difference between stack and heap. These are the 99% problems when programming in C and the most of times these are the things that will make you confuse if you doesn't have them clear on your mind. After all they are not difficult once you understand them. But if you only follow tutorials without practice and play with them you will think you grasp it only to be trapped.
Jose
Focus on pointers, references, memory allocation and pointer math, difference between stack and heap. These are the 99% problems when programming in C and the most of times these are the things that will make you confuse if you doesn't have them clear on your mind. After all they are not difficult once you understand them. But if you only follow tutorials without practice and play with them you will think you grasp it only to be trapped.
Of course its difficult. Take this example: https://github.com/u-boot/u-boot/blob/master/drivers/net/e1000.c#L238-L276 If you can't understand what's going on this code (not what it does, what is the intended objective) in less than 10 minutes, the code is tough. And no, it's not a quiz or a challenge. This is the example of bad practice at business logic in C: mix everything and good luck
Thadeu
The naming convention, the masks, the obfuscation... its complicated unnecessarily
as being a driver and dealing with different variations, there is no way of avoid the numbers in names. By masks well, I'm not a driver developer, so it is difficult to have an opinion on if it is the better problem solving way. Also semaphores are a harshness apart. It is very very specific. I really doesn't like the standard conventions on C. As I only would use CAPITALIZED for constants. Even for macros I would use snake case like vars and functions. Upercase only for initials of namespacing ex: T8_arr_len() Macros that doesn't behave as functions or values I prefer to avoid at all. And if they behave like functions there is no need to follow a different naming convention, even when polymorphic (the main use I did of function-like macros is for polymorphism on memory management on data structures). I'm not a senior C, and I prefer to not take the boat of the traditional strangeness... :P
Camaro
Hello guys) I would love to get an answer for this question: Let me share a small portion of code I have written in C++: int* ptr; int var = 7; ptr = &var; int &ref = var; after writing this block of code, I've realized that the addresses that store the variables var and ref are equal. The values these two variables store are the same too. However, I just don't get it in terms of actual numbers of variables the OS memory has allocated for: did the OS allocate memory for ref and var separately or did it allocate only 1 spot in memory for these two(var and ref) variables (if so, does it mean that the spot in memory has two names/identifiers (ref and var)?
Salaheddien
How to code (Read an NxM matrix of characters. To display it line by line, then make it a display)
Camaro
I read in c++ primer that references are not object, they are just another name for an already existing object while pointers are object
So that basically suggests that the object has two names, which are 1. Reference 2. Name of the object/variable ?
Lav
Hello guys I am having some problem running a code can anyone help me?
Lav
fatal error: mysql.h : No such file or directory
ÐΞΛÐ HΛϾКΞЯ
fatal error: mysql.h : No such file or directory
Have you installed the connector ?
Lav
Yes,while installing the server I did tthat
Lav
Have you installed the connector ?
Maybe I can just send you the pic
Chat Boss
B220059_Subhra Bhanja sent a code, it has been re-uploaded as a file
B220059_Subhra_Bhanja
B220059_Subhra Bhanja sent a code, it has been re-uploaded as a file
can anyone please check if RBinSearch function? I am not getting the desired output?
Chat Boss
Anthony Silva sent a huge message, it has been re-uploaded as a file Hi everyone, i'm trying to resolve an C exercise where i have to convert number into an intenger..
Chat Boss
Anthony Silva sent a huge message, it has been re-uploaded as a file Hi everyone, i'm trying to resolve an C exercise where i have to convert number into an binary, ..
Anonymous
Camaro
Hello friends) I've searched for the definition of an inline function, and basically all sources provide this answer: "An inline function is one for which the compiler copies the code from the function definition directly into the code of the calling function rather than creating a separate set of instructions in memory." I thought an inline function would be useful to work with functions and pass the value of an argument x, which is in main() scope, into function. That way, I thought the argument in main() scope would be affected and changed since the inline function does not copy the value but writes the actual code into the main() scope. I expect the argument to be changed, yet it did not. Then what is the problem? Or is there something I've missed? here is the code: #include <iostream> using namespace std; inline int increment (int x) { return ++x; } int main() { int a = 5; cout << a << endl; increment(a); cout << a; return 0; } the variable 'a' remains 5...
Chat Boss
Dmitrii sent a huge message, it has been re-uploaded as a file Your code: #include <iostream> using namespace std; inline int increment (int x) { return +..
Camaro
You should use int&x instead of int x. Basically, because input arguments is new variable and then you work with this variable. This means that you will have something like: int main() { int a = 5; //Inlined function int x = 5; ++x; }
Ok, but there is no argument 'x' in this scope. According to the inline function definition, I thought the compiler would look like this: int main() { int a = 5; ++a;//Inlined function (I wrote ++a because this is what inline functions, according to the definition, does) } I am not sure if the x is a new argument since with other functions(for example using pointers) there is no new variable being created. Or am I wrong?
Dm
pointers provide information about memory address where you can go and at least read this value, the same with references of course.
_amiretoon_
Hello guys I have a question about ipconfig. Is there a chance that we write a code with c++ in a website to find the location(city) of the customers by their ip address?
Dm
So the question is about ipconfig, c++ web server, or the geolocation?
ow I also have one question. I want to create server which can work with multiple client at the same time (not necessary to be fully asynchronous). I finished first version on bare blocking socket (just for familiarization with sockets). How can I reach my goal and make server works with multiple users? what is the easiest way? I see only 2 options: boost.asio || 1-2 threads and non-blocking bare sockets. Maybe it's possible to use my code (blocking sockets) and std::async but I'm not sure that std::async will help me in this case. Can you recommend me what will be the best and easiest option?
_amiretoon_
So the question is about ipconfig, c++ web server, or the geolocation?
It's a combining of them I need a code which can find the origin and a location of an ip adress. I need a code because of this: visiting a website in a period of time noticeably creates an algorithm I need to know how to prevent a code so I can estimate this algorithm and find the source of that person's ip address too. Is it possible? Or these are just two different things and can't be combined?
Løstrëgõ
1 1 2 1 1 3 3 1 1 4 6 4 1 Can it be printed using a loop?