Lodovico
Why using std::string and not primitive c arrays?
The c_str converts it to char* is it bad idea?
Vishnu
I mean you can use tolower(), toupper(), islower(), isupper() from <cctype>
Could you please show that to me? The working code that is. Initially I've tried the similar way you suggested. From <string.h> , I've used strlwr() and strupr() to convert the strings . But i messed up in the if - else part where the program should convert an upper case to lower and lower case to upper. Mine did only one of those conditions
Vishnu
Would be helpful because I've been trying for a bit . Finally had to rely on ChatGPT only to get a complex way to do that program
Danya🔥
или русский?
/warn Говорим по-inglés solamente
John
I Want c++ books any one please
Laopigo
I Want c++ books any one please
https://en.cppreference.com/w/Cppreference:Archives
Harsh
I want some projects based on c, c++
Buffer
I want some projects based on c, c++
What are the project u guyz are working on in c or c++?
Anonymous
What are the project u guyz are working on in c or c++?
There are a lot of open source projects in C and C++ mentioned in the link above. Read the rules before posting a question
Danya🔥
/ban @NANCYCHEUNG
Vishnu
strlwr and strupr can't be used to std::string as is it accept C array reference. And it converts entire char in string
Well, I want to convert the entire char. i want to get uppercase when i enter lowercase and lowercase when i enter uppercase apple => APPLE APPLE => apple
Sanjana
Hii I want to learn entire c++, basically revise full concept with vectors
Manav
Hii I want to learn entire c++, basically revise full concept with vectors
Um.. C++ has a lot more things then vectors, also assuming you're talking about std::vector, it's a part of the standard library. Your question doesn't make much sense. What is it you're really asking for?
Dima
its going to take more than 60 years
Dima
ez
Ehsan
its going to take more than 60 years
people live older than 100 now so I think its worth it
Sanjana
I said i want to revise whole c++ so I want nice resource
Dima
Danya🔥
Danya🔥
Thanks
See you in 20 years
Manav
http://eel.is/c++draft/ Go for it
That'll make them run away, probably.
Danya🔥
Manav
Thanks
It's just a reference site, treat it as such. The thing you're trying to do is not really feasible.
Manav
Maybe get a beginner book on C++, pinned message has links to resources
\Device\NUL
Why would we replace default memory allocator with stuff like mimalloc, tcmalloc,or jemalloc ? I'm confuse which one should I use
Vishnu
I said i want to revise whole c++ so I want nice resource
Lmfao Entire C++? Are you the peak of human intelligence?
Anonymous
Why would we replace default memory allocator with stuff like mimalloc, tcmalloc,or jemalloc ? I'm confuse which one should I use
For most of the general use cases, you won't change the allocator. But there are some special cases where you want a custom allocator. For ex, if you know some objects you allocate are of the same size (and if this is in a code segment which needs to be extremely fast) and you don't want these objects intermingled with other objects you allocate, then you can use your own allocator which is specifically designed to allocate and free objects of this size from a buffer that you own. This saves a lot of fragmented memory with spaces inbetween that are not of the right size and also makes memory allocation and deallocation much faster because you don't use system calls during allocation and deallocation (with the caveat that not all allocation and deallocation calls with new and delete result in system calls). Also since C++17, the process of writing allocators has been very much simplified with pmr. It is still complicated but less so when compared to how it was before C++17
Anonymous
Why would we replace default memory allocator with stuff like mimalloc, tcmalloc,or jemalloc ? I'm confuse which one should I use
As far as questions related to the particular allocators in question like mimalloc, jemalloc etc, their GitHub page documents in detail why you would use them For ex mimalloc doesn't maintain a single free list which is disadvantageous as it leads to fragmentation and is also slow. Read the documentation to find out why the concerned allocator is better than the standard allocator and see if it fits your use case
Ahsi
Hello I am new here How I Start programming 😮
Dima
practice, practice and practice
Dima
ditch the courses
Ahsi
Which best website for c++ programming
Anonymous
Hello everyone. I have learnt recently C programming, and I want to learn C++ . So, can you recommend me some resources for C++ ; such as good videos, pdfs, wibsites,... etc
Dima
read the rules
21BCS1029_Jalani_Aniruddh
How to find array size in a function in which array is passed as a parameter?
21BCS1029_Jalani_Aniruddh
DM me
Danya🔥
Or use std::vector
Danya🔥
sizeof(array)/sizeof(data type size)
Don't suggest this anymore
Danya🔥
it just works (tm)
It just does not
Dima
It just does not
argue with a cumpiler, not with me
Dima
Danya🔥
Are you sane?
Dima
kinda
Dima
jk its better to keep a separate counter for elements in array
Dima
sizeof(void*)/sizeof(void*)
Danya🔥
Please take your medicine
Anonymous
How to find array size in a function in which array is passed as a parameter?
The suggestion is just dont use array they are boring prefer vectors
imminent
sizeof(array)/sizeof(data type size)
now try this on an array, where size isn't known at compile time
Anonymous
Don't suggest this anymore
Yeah it gives wrong output thanks
Anonymous
int sz(int arr[]) { cout<<sizeof(arr)/sizeof(arr[0]); } int32_t main() { int arr[3]; sz(arr); return 0; } OP=1 which is wrong
大宝剑
#ifdef __cplusplus extern "C++" { template <typename _CountofType, size_t _SizeOfArray> char (*__countof_helper(_UNALIGNED _CountofType (&_Array)[_SizeOfArray]))[_SizeOfArray]; #define __crt_countof(_Array) (sizeof(*__countof_helper(_Array)) + 0) } #else #define __crt_countof(_Array) (sizeof(_Array) / sizeof(_Array[0])) #endif
大宝剑
C++
both C and C++
大宝剑
Which programming language is this?
it's a system .h file , you can use it in your pure C project
大宝剑
actually we used __countof and RTL_NUMBER_OF macro for many years
大宝剑
They're so common I thought any developer with Windows experience would know them
Ahsi
I want to add press 'y' to continue in c++ program help
klimi
I want to add press 'y' to continue in c++ program help
- print message - read input by character - check for y - continue
\Device\NUL
it's a system .h file , you can use it in your pure C project
That is specific MSVC code and should not be used because it's not portable
\Device\NUL
actually we used __countof and RTL_NUMBER_OF macro for many years
I thought Rtl API is Windows Internals APi and should not be used for general usage (?)
大宝剑
I thought Rtl API is Windows Internals APi and should not be used for general usage (?)
I always ignore the rtl tag, and i used to get some tips to use them in msdn
大宝剑
i think it's safe, maybe this is why some symbols has the tag: