Azadi
hi i am beginner C proggraming so all of us help me provides some resources
Curious to know the reason you chose C but not C++!
Azadi
This is not a bad error, but a good one! casting mostly should be avoided unless very needed. C++ casts should be used (if you code in C++) mainly. AFAIS, you're converting two unrelated types, something that should be done using reinterpret_cast.
Azadi
I'd edit and then compile it.
Azadi
reinterpret_cast allows any pointer to be converted into any other pointer type. It also allows any integral type to be converted into any pointer type and vice versa. I don't think it will fix the issue as C-style cast does the same (at least here). It works by mixing reinterpret_cast, static_cast and const_cast.
Azadi
'HMENU' is seemingly of a pointer type and 'WORD' an integral type. so you know where to use it.
Anonymous
Curious to know the reason you chose C but not C++!
Because if u learn c it's very easy to learn c++.
Anonymous
I am tooo learning c almost completed basics then questions and then jump to c++
Mohamed
tomorrow i have a final exam in c++
Anonymous
Guys See if I have an array and i am accessing it's first element So the value inside arr[0] will be a subscripted value ? Just i want to know what's actually the subscripted value.
27Onion
I think the subscripted value is the value that is subscripted
27Onion
So I think that will be arr in this case
Azadi
Guys See if I have an array and i am accessing it's first element So the value inside arr[0] will be a subscripted value ? Just i want to know what's actually the subscripted value.
Using a subscript operator [ ] you can access the elements of the array. The index starts from 0, so ar[0] is the first element, ar[1] is the second element and so forth.
𝔖𝔞𝔯𝔬
𝔖𝔞𝔯𝔬
Some are relative to oop and some are not, but still, C++ is way bigger than C
27Onion
Arr is the array bro
yeah the array is the one which is subscripted
27Onion
it's subscripted by the subscript
27Onion
🤔
27Onion
Because if u learn c it's very easy to learn c++.
hopefully you will say "it's very easy to learn C++" after meeting classes, references, rvalue & xvalue & glvalue & prvalue, polymorphism, overloading & overriding, smart pointers, templates(template metaprogramming, variadic template, etc.), constexpr and consteval, coroutines, ranges, iterators, structured binding declarations, etc.
27Onion
only listed a part of all the C++ new features above
27Onion
oh and modules are coming soon
Anonymous
hopefully you will say "it's very easy to learn C++" after meeting classes, references, rvalue & xvalue & glvalue & prvalue, polymorphism, overloading & overriding, smart pointers, templates(template metaprogramming, variadic template, etc.), constexpr and consteval, coroutines, ranges, iterators, structured binding declarations, etc.
But I will learn it i know 😁 Soon c basic will be completed then I will do some questions and then c++ I have done python basics and ds queries arrays string list etc but But learning it was i think make easy to learn c understand some concepts So may be c concept little bit will help to learn c++ too
Anonymous
Some are relative to oop and some are not, but still, C++ is way bigger than C
Ofc it will be that's why it is made But for cp i have to do it
Anonymous
How to install GCC 13 on Ubuntu 20?
What version are you on? If you are on anything lesser than 23.04 then you have to live with gcc 12. Use this link to add an apt repo through which you can install the latest version of gcc and stuff https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/ppa
Danya🔥
Is this repo supported on Ubuntu 20?
Anonymous
Is this repo supported on Ubuntu 20?
Yes it is. But unfortunately you can't update to gcc 13 using it.
Anonymous
Why?
I don't know the exact reasons but no one seems to have built the gcc toolchain for version 13 for any version lesser than Ubuntu 23.04. I don't know the reason. I will find out why. Probably some kernel update and new kernel API support which the gcc 13+ compilers expect which got added to Ubuntu only post 23.04
Danya🔥
You don't have to find out why, but thanks
Anonymous
You don't have to find out why, but thanks
I did find out and I was right. The reason is the eventpoll changes that were made in Kernel 6.2. Some changes were made to iouring and eventpoll that prevent recursive calls which was causing problems for the stackless coroutine implementations in GCC. These changes were made in 6.2 kernel which made it into Ubuntu 23.04 version. The kernel team also backported the changes to the previous kernels but Ubuntu hasn't yet made these changes available through its update repositories. So you can infact update your kernel and install gcc from code.
Giuseppe pio
Hi guys
Giuseppe pio
can anyone help me with a little problem i'm having with a code on codeblock?
Giuseppe pio
my code when i use it on visual studio it works, but when i pass it on codeblock adding headers it starts telling me : undefined reference to... can someone help me please
Pavel
Anyone faced issue with clang format, that It doesn't break the closing brace of a multiline initialization list, can't find a specific setting for that, have searched for "brace" in the docs and in the json with the definitions, no luck. BreakBeforeBraces doesn't seem to affect this, the issue happens if I set Stroustrup or Allman there. Example of the code return MyStruct{ myData1, myData2};
Pavel
My expectation it to be like this return MyStruct{ myData1, myData2 }; It works only if I enter comma at the last line, but not in this case
Azadi
My expectation it to be like this return MyStruct{ myData1, myData2 }; It works only if I enter comma at the last line, but not in this case
I didn't get the problem (probably better to share your code). Whitespaces are ignored by default in C++.
Pavel
I didn't get the problem (probably better to share your code). Whitespaces are ignored by default in C++.
This is minimal .clang-format file that I can repro it with (with the code above) BasedOnStyle: LLVM BreakBeforeBraces: Allman ColumnLimit: 0 The issue that it formats the code not how I would expect it to do.
Pavel
Anyone faced issue with clang format, that It doesn't break the closing brace of a multiline initialization list, can't find a specific setting for that, have searched for "brace" in the docs and in the json with the definitions, no luck. BreakBeforeBraces doesn't seem to affect this, the issue happens if I set Stroustrup or Allman there. Example of the code return MyStruct{ myData1, myData2};
So, OK, I think I figured that out If I use BasedOnStyle: GNU and remove Cpp11BracedListStyle option, then it works 🤷‍♂️ hopefully I can fix everything else that got broken, but GNU seem to be closer to my format (have no idea why clion decided to base it on LLVM when generating this file from its settings) (OK, nvm, most of my explicit options stopped working completely after I did that, probably I'm not yet ready for clang format) That was my issue, it actually worked well.
Anonymous
Can anyone tell how to know the length of an array but but U have given a pointer that points to the array and is passed in a function And u can't access array directly because u haven't pass that array as a formal argument in function only u have pass is ptr For eg: bool function(int*ptr) Function is like this and Ptr points to array So how can I find the length of array In C
Anonymous
By traversing??
Garry
hi , i installed the minGW compilers but codelite doesn't detect them,i've trued adding them manually but it still doesn't detect them.
Azadi
Can anyone tell how to know the length of an array but but U have given a pointer that points to the array and is passed in a function And u can't access array directly because u haven't pass that array as a formal argument in function only u have pass is ptr For eg: bool function(int*ptr) Function is like this and Ptr points to array So how can I find the length of array In C
You should pass the array size too, like: bool f(int* ptr, size_t sz) { /* ... */ } The name of an array will decay to a pointer too much easily but you need the size in C++ and C (I assume). One of the advantages of using C++ over C is its brilliant STL containers, like std::array or std::vector in this case, which include their size with themselves.
Azadi
yes
Have you tested it on CMD to see if it's recognizable?
Garry
codelite just wont detect
\Device\NUL
yes
What it shows gcc --version
Azadi
There are no such as heap memory size detection on Standard C
C-style array is not on the heap, it's on the stack.
Garry
im currently using the winlibs ucrt compiler
\Device\NUL
Garry
What it shows gcc --version
it shows clang clang++ cobra gnu g++ gnu gcc in the Build settings>compilers
Garry
Have you tested it on CMD to see if it's recognizable?
i've tried adding manually ,it does gets added but when i run the setup wizard i doesn't detect again
Azadi
it shows clang clang++ cobra gnu g++ gnu gcc in the Build settings>compilers
I haven't used CodeLite but it should be set to use gcc in its settings, I suppose.
Garry
so any idea how i can solve this??
Anonymous
There are no such as heap memory size detection on Standard C
If size of an array is also given and ptr that points to that array given in a function then how we can do
Garry
27Onion
so any idea how i can solve this??
Give up, and use neovim
Garry
Give up, and use neovim
actually the course im following uses codelite
27Onion
my course uses Dev-C++, and I still use my neovim to take the course
27Onion
who cares
27Onion
😉
Garry
what is neovim
27Onion