klimi
C program example
are you trying to ask for something?
Thumar Viren Mahendrabhai
Yes
klimi
What are you trying to ask for?
Thumar Viren Mahendrabhai
I want an example of c language
Thumar Viren Mahendrabhai
I want an example of c language
klimi
I want an example of c language
https://elixir.bootlin.com/linux/latest/source/kernel/exit.c
Thumar Viren Mahendrabhai
I want an example of c language for basic
klimi
I want an example of c language for basic
here is the source code for BASIC in C: https://github.com/JmBergamoJ/basic-C-interpreter/blob/master/PARSER.c
Thumar Viren Mahendrabhai
Turbo c++
klimi
Turbo c++
turbo c++ is not supported in this group
Thumar Viren Mahendrabhai
Why
DUNCAN
Thanks
klimi
Why
it's so old that it's not longer sane to use
klimi
* If you encounter a problem, while using dev C++ or turbo C/C++, you will not be helped, use another more modern IDE.
innocent
Turbo c++
Are you in coma for 20 years?
Thumar Viren Mahendrabhai
No
Jude
Implement a C program to read a string from the user and sort it using bubble sort. Print the last 5 characters of the sorted string.
Jude
Can any one know to slove this
klimi
Can any one know to slove this
Have you read the rules? What do you expect us to do? Be glad and do your task?
Sandeep
How do I swap elements of a 2D vector
Anonymous
If anyone have already worked in EMVco qr code concept please let me know..
Blexy
Thank you
Captain
https://t.me/programminginc/283193
Anonymous
Ciclonite
Hi! Some one have used tinyxml2 in c++ for parse an file generated from nmap?
Ciclonite
i'm unable to parse the file. https://pastebin.com/RCkXdu38
Ciclonite
this is a sample output, i need to get the ip and the host name.. Tinyxml give me always null
Pavel
this is a sample output, i need to get the ip and the host name.. Tinyxml give me always null
Did you try to remove parts of the file to figure out where it starts giving not null I would start with the comment (starts with <!-- and ends with -->), tinyxml may have problems with reading those
Oluwatoba
Hi,pls I wanna learn c++ and I don't have any knowledge of it ,can anyone share me note or link I can start the course from
YVEF
Hi guys. the question is next: what if I allocate string on a stack like : std::string str = "hello", than send it to some function by pointer like _some_func(*str); in this function I store the string pointer in an array which is heap allocated. so the question is - original string will be permanently on my thread stack until disposing? how it manages if I got up on the stack can I rewrite the stack frame with my string? or it has implicite copy to heap?
YVEF
No. This will most likely result in Undefined Behavior. As soon as the function in which you allocated str ends, the memory used by str will be reclaimed. So the pointer to str in the heap allocated array will be an invalid pointer.
thanks. so, in my case, if I catch the string by : std::cout » str; I should call heap allocation to send to function like _func(new std::string(str)); ?
Anonymous
thanks. so, in my case, if I catch the string by : std::cout » str; I should call heap allocation to send to function like _func(new std::string(str)); ?
I don't understand what you mean by catch the string using cout. And if you want the string to persist across function calls you must allocate it on the heap and not on the stack.
ian
(Besides books) Do I need to read a standard, for example the C ++ standard if I want to learn C ++?
Felix
hello may i ask "Don't post compuler executanles, that is onviously a security risk" why is it risky?
Anonymous
(Besides books) Do I need to read a standard, for example the C ++ standard if I want to learn C ++?
No. Please don't. C++ standard is not meant to be read by beginners and definitely not meant to be read cover to cover by regular users. Once you have read the books in the recommended list, you would reach a level of proficiency where you can look up the standard for specific sections that you want more information on.
Diego
hello may i ask "Don't post compuler executanles, that is onviously a security risk" why is it risky?
I don't usually do this, but please proof-read your messages for spelling 😅 It's a security risk because we don't know what is actually written in the executable, thus, it's untrusted code Even if you share the source code, there is no way to know for sure that the source code is the same as what's compiled in without doing more work than would've gone to compiling it by oneself Let alone the fact that you'd be running an exe file you got from some rando on the internet
Anonymous
It really sucks how unfriendly C++ is for beginners, specially for good documentation and even what you should be looking for But I suppose it's natural for it to have info so spread out
Cppreference ???? And as far as what beginner's should do, Isocpp.org offers so many tips and advices. So it is not the lack of information but the lack of knowledge on what to look for and where that hinders beginners.
Prince Of Persia
What will happen if I do erase a non-existent element in a container (i.e. std::vector)
Prince Of Persia
My reference book said nothing about it
Prince Of Persia
And I haven't found it on google
Anonymous
And I haven't found it on google
Are you sure? Did you check cppreference?
Pavel
What will happen if I do erase a non-existent element in a container (i.e. std::vector)
It depends on what method you will use do do this. All the behavior for specific cases is documented on cppreference.com
Prince Of Persia
Anonymous
Not in my Google list
If I search for std::vector erase the first link that comes up on Google is cppreference
Pavel
It depends on what method you will use do do this. All the behavior for specific cases is documented on cppreference.com
E.g. if you use erase-remove idiom to remove an object, then remove will return end iterator and erase will remove nothing
Pavel
std::vector::erase(b,e) or std::vector::erase(it)
https://en.cppreference.com/w/cpp/container/vector/erase You need iterators to remove elements using erase, how would you get them for nonexistent elements?
Prince Of Persia
Return value Iterator following the last removed element. If pos refers to the last element, then the end() iterator is returned. If last==end() prior to removal, then the updated end() iterator is returned. If [first, last) is an empty range, then last is returned. Exceptions Does not throw unless an exception is thrown by the assignment operator of T.
Prince Of Persia
Using vec.end() or using an erased it
Or using iterators from another container (mistakenly) Or invalidated iterators
Anonymous
Or using iterators from another container (mistakenly) Or invalidated iterators
Those are all Undefined Behavior. You must be stupid to do that on purpose
Shayan
Hi i am biginer can you all teach some codeing in c++
Prince Of Persia
Or using iterators from another container (mistakenly) Or invalidated iterators
In list Iterator can't be out of range by itself (except erasing the element) but in vector you can get elements far away from end()
Prince Of Persia
Prince Of Persia
Pavel
Using vec.end() or using an erased it
Using erased it would cause UB (use of invalidated iterator), using end depends on what overload you use (it's on the page), if it says that you can't do that, that means UB in this case (it usually means either it won't compile or UB, in this case it will compile).
Anonymous
Or from a relocated vector
Why would you save an iterator knowing very well that you are doing operations that can cause the vector to be reallocated? That is a coding issue and I wouldn't touch such code least of all employ such a coder.
Pavel
Or using iterators from another container (mistakenly) Or invalidated iterators
The first one is actually one of the reasons why ranges was such a desired feature, to avoid potential errors of using iterators from a wrong container (due to copy-paste mistakes).
Prince Of Persia
Thank you
Prince Of Persia
Is there anywhere to see std lib classes codes?
Prince Of Persia
github.com/Microsoft/STL
What About GCC(G++)
Anonymous
What About GCC(G++)
https://letmegooglethat.com/?q=libstdc%2B%2B+github
Anshul
Why static memory allocation is faster than dynamic allocation
Suka
Why static memory allocation is faster than dynamic allocation
ig because static get allocated at compile time and dynamic at runtime dynamic have to check is the requested allocation doesn't overlap or pc have enough memory to do that? cmiiw
Anshul
In static memory allocation (SMA) memory is not allocated at compile time
Anshul
In SMA it's just we know that this much is the memory requirements