Abhi
Who is the best teacher of c online for beginners please tell me I am bca student
(Current).
Hi everyone
(Current).
Which is the best app for c++ coding
(null)
Which is the best app for c++ coding
cat > main.cpp << EOF
Never Spam Bot
exo sent multiple messages that looks like a spam. To stop the bot from deleting your messages, write something non-suspicious. Or find out why here. Spam deleted in this group: 1886 See spam? Quote the spam message in the group and reply with /spam
(Current).
No
exo
No
why you can’t just g00gling it?
exo
too bored?
(Current).
Yeah
(null)
As long as you have a sensible LSP, such as clangd or ccls, and an editor that supports LSPs, you should be good. There is no best out there. You need to find what you like the most. If you wanna write C++ code on your phone, just don't, unless you only want to print hello world or sth. Not that it's not possible to write code on phone (a lot of people write code in Termux) but it's annoying.
(Current).
Is there anyone student of computer science
(null)
LOL. No. Termux is not only for ethical h4x0r. It's just an android terminal emulator. Nothing magical about it. You can use neovim or other LSP-supporting editors in Termux. I think there is an arm binary for helix as well. Eh. Anyway.
(Current).
Install Kali Linux on termux
Never Spam Bot
(Current). .(Trader)🎭 sent multiple messages that looks like a spam. To stop the bot from deleting your messages, write something non-suspicious. Or find out why here. Spam deleted in this group: 1891 See spam? Quote the spam message in the group and reply with /spam
exo
Install Kali Linux on termux
lmao ur 13yo or what?
(null)
lol, you need to use cxxdroid application
Imagine you have a huge project that has a race condition problem or a deadlock and you wanna use a debugger to find out what is going on. What are you gonna do with cxxdroid? Or let's say you want to find out about memeory leaks in your software. Termux won't give you that in an integrated manner, but you can use valgrind and gdb with ease. Some IDEs like QtCreator or CLion has them built-in, but you can't use them on your phone (ACTUALLY?! You can, but you don't want to hate yourself, do you?)
(null)
I think you can't debug a simple segfault with this cxxdroid. Not to mention that you don't have a profiler as well.
Miracle 🐶 🦴
How long does it takes to mastered c
__Suraj__
how old you are?
Miracle 🐶 🦴
__Suraj__
How long does it takes to mastered c
according to your continuously and disciplined activity, it takes 6-8 month and few years or your lifetime
(-__-)
Hello guys, in this example does "Hey" is a string literal or a C-string ? #include <iostream> #include <string> using namespace std; int main() { string s("Hey"); return 0; }
klimi
Okay, please, stop the offtopic and meta questions. This is not the place to ask here
klimi
Hello guys, in this example does "Hey" is a string literal or a C-string ? #include <iostream> #include <string> using namespace std; int main() { string s("Hey"); return 0; }
you can use trick to call a method to get it's type: s.telltype(); k11m1@klimovo/tmp$ g++ -Wall -Wextra test.cpp test.cpp: In function ‘int main()’: test.cpp:9:5: error: ‘std::string’ {aka ‘class std::__cxx11::basic_string<char>’} has no member named ‘telltype’ 9 | s.telltype(); | ^~~~~~~~
(null)
Hello guys, in this example does "Hey" is a string literal or a C-string ? #include <iostream> #include <string> using namespace std; int main() { string s("Hey"); return 0; }
> "Hey" is a string literal. It gets stored in the code section. > s on the ohter hand is something else. std::string ctor will take "Hey", and pass it to a magical function to allocate a region of memory for it (on heap), copies it to that location and holds a pointer for you to that memory region. It's a basic_string<char> https://en.cppreference.com/w/cpp/string/basic_string > The code below holds a pointer to the string literal in the code section. const char* pointer_to_str_literal = "Hey"; > This is an example of a c string (in stack): char c_str[] = "Hey"; c_str[0] = '-'; > This is an another example of a c_str (in heap): char *ptr = malloc(sizeof(*ptr) * 4); strcpy(ptr, "Hey"); In all of the examples above, "Hey" remains as a string literal because it is between those two double quotes, but you copy it to different locations of your memory. Learn about virtual memory. It'll get easier to understand what happens with strings.
Rose
User john has 1/2 warnings; be careful! Reason: instagram ad
(Current).
Is there any relationship between c++ and python
Never Spam Bot
Akash sent multiple messages that looks like a spam. To stop the bot from deleting your messages, write something non-suspicious. Or find out why here. Spam deleted in this group: 1901 See spam? Quote the spam message in the group and reply with /spam
klimi
Is there any relationship between c++ and python
python uses c++ backend (like libs and stuff i think)
(null)
python uses c++ backend (like libs and stuff i think)
Wrapping C++ libraries in python is actually a pain, but they've done it for several libraries like OpenCV. pybind11 is nice for C++11. Python (CPython to be precise) is more related to C, because the interpreter is written in C. https://devguide.python.org/internals/ Can help you to understand the language itself better actually. @Current1x
(null)
Wrapping C++ libraries in python is actually a pain, but they've done it for several libraries like OpenCV. pybind11 is nice for C++11. Python (CPython to be precise) is more related to C, because the interpreter is written in C. https://devguide.python.org/internals/ Can help you to understand the language itself better actually. @Current1x
And I'm not talking about algorithms and such. You can write a better code in python when you know C because you can read the underlying implementation. You need to deal with a lot of abstractions but still. Like... you can trace how many mallocs/mmaps happen in the code–and the size of allocation if that matters to you (maybe for micropython users? It's an another interpreter but yet, it's written in C), or how many dereferences is needed to access a specific data, or even understanding which data type is a better choice. Knowing that a set is a hashmap, tells you why accessing a value in a set is faster than lists. Or you don't randomly point your finger at the output of id() and say uh-huh! That's my integer! No. That's your PyObject structure that holds a refcount, a pointer to a structure that knows your data type and the way that it needs to handle your data. You can define a list with two integers and get a diff from their ids. You'll get 32 bytes, the size of PyObject, which is cool. define a string, and you'll see it gets mmap-ed to another location not too far but still a different region, because strings are immutable in python... why? because they wanted to mmap them read-only.
Muhd
/start@MissRose_bot
Rose
/start@MissRose_bot
Heya :) PM me if you have any questions on how to use me!
(null)
what do you mean by "code section"
I don't know how much you're aware of these things... so if something is unclear, just ask. They call it by two different names; text section and code section. This is where your "assembled" code gets stored in the executable file. When this section gets loaded into memory, we call that area text/code segment. All of your instructions are there. (only your code tho) The CPU will eventually jump to that location to run your program. (The address is virtual... but you don't need to worry about that) String literals do not differ from integer literals. In this code int foo = 12; 12 is an integer literal. If you look at the assembly code, you'll see that depending on where you put this piece of code your compiler will decide to put this 12 in a register or the data section. No matter what, that 12 is a part of the code as an operand. In assembly it should look like this: mov DWORD PTR [rbp-4], 12 ; moves 12 to the stack OR foo: .long 12 ; long is a directive that stores 12 in the current section ; *foo* will be its address String literals are the same: mov DWORD PTR [rsp+16], 1145258561 ; moves "ABCD" to the stack 1145258561 is a representation of "ABCD". It's hard-coded in the code section. That's what I mean by "It gets stored in the code section". The thing is, you can address different locations of your code section as well. That's what happens to a large string literal. Your compiler will put it at the bottom of the code section and label it. That label will get replaced by the address of your string literal in the code section after the assembling phase.
(-__-)
I don't know how much you're aware of these things... so if something is unclear, just ask. They call it by two different names; text section and code section. This is where your "assembled" code gets stored in the executable file. When this section gets loaded into memory, we call that area text/code segment. All of your instructions are there. (only your code tho) The CPU will eventually jump to that location to run your program. (The address is virtual... but you don't need to worry about that) String literals do not differ from integer literals. In this code int foo = 12; 12 is an integer literal. If you look at the assembly code, you'll see that depending on where you put this piece of code your compiler will decide to put this 12 in a register or the data section. No matter what, that 12 is a part of the code as an operand. In assembly it should look like this: mov DWORD PTR [rbp-4], 12 ; moves 12 to the stack OR foo: .long 12 ; long is a directive that stores 12 in the current section ; *foo* will be its address String literals are the same: mov DWORD PTR [rsp+16], 1145258561 ; moves "ABCD" to the stack 1145258561 is a representation of "ABCD". It's hard-coded in the code section. That's what I mean by "It gets stored in the code section". The thing is, you can address different locations of your code section as well. That's what happens to a large string literal. Your compiler will put it at the bottom of the code section and label it. That label will get replaced by the address of your string literal in the code section after the assembling phase.
thanks very much
Rahil
How to Stay Consistent in Coding Daily
y
Someone can explain me when can I use this. \n or what is the fuction?
Zeenat
Q: implement a hash table in c with collision resolution ,,,
Zeenat
Please provide solution
Sheezan
Ok
(Current).
How to find agregate using c++
Ludovic 'Archivist'
How to find agregate using c++
Depends on the aggregate function, look for fold_left, fold_right, and similar functions on cppreference.com
(Current).
Ok
Ludovic 'Archivist'
Ok
(it will be in the algorithm library for reference)
(Current).
Yeah
Maxim
Please provide solution
from the rules: You should not ask exams/homework/interviews solutions. This will get you banned
Chat Boss
from the rules: You should not ask exams/homework/interviews solutions. This will get you banned
Read the pinned message regarding homework. https://t.me/programminginc/453966
Yep
Hey guys
Yep
anybody can suggest me course for c best resource?
__Suraj__
anybody can suggest me course for c best resource?
GeeksforGeeks, you can leared C language in free
Programmer
What is difference between time complexity and amortized time complexity?
Ludovic 'Archivist'
What is difference between time complexity and amortized time complexity?
Amortized takes into account repeats of the same operation. For example, std::vector::push_back may resize, which is O(n), but whatever the amount of elements you push back, it will resize logarithmically, so it will never move elements more than 4 times the amount of elements added in total, so on a large batch std::vector::push_back is O(1), that's its amortized cost
__Suraj__
This is PDF or site
it's web applications
(Current).
Thanks
Programmer
Most probably I think although I have not seen the source code of vector implementation... but I think vector intial capacity is 1 ( if not mentioned) and it doubles as we add elements...
Programmer
Am I right ?
Pavel
Am I right ?
So the capacity for these cases is implementation dependent, usually it is zero by default so the vector doesn't allocate unless something is put into it, then it can be one or theoretically other number, then it usually doubles
Pavel
It can theoretically be not one, because for small types it may be better to allocate memory for multiple elements at the same time instead of doing 3 allocations for the first 3 elements
Arya
/get
Rose
/get
Not enough arguments!
Never Spam Bot
Programmer is now approved by the group admin and can send messages without any restrictions Vector grows double in size if I add elements...but It does not shrink if I delete elements... am I right ?... even if I delete multiple elements.. See spam? Quote the spam message in the group and reply with /spam
Ludovic 'Archivist'
Programmer to shrink a vector, you can use std::vector::shrink_to_fit
Programmer
But by default it does not..
Ludovic 'Archivist'
But by default it does not..
You need to shrink it explicitly, this avoids shrinking when it would waste performance, as generally having a bit more memory held is not a problem