s
the problem is that your function bubbleSort needs as 3rd argument a pointer to double array, but you are putting there a single double value
can you maybe show me a possible solution? I mean if I set the double *a[] that still would not be correct right?
s
I will try it
klimi
can you maybe show me a possible solution? I mean if I set the double *a[] that still would not be correct right?
double double a = 5 pointer to that= &a array of doubles double a[5] pointer to the array a a
s
double double a = 5 pointer to that= &a array of doubles double a[5] pointer to the array a a
could I create a name function that stores A B C D E.... as integers?
s
I think this quest is too high for me
s
have you maybe a line of code that explains the double situation,😅 please.
klimi
49 | bubbleSort(n,name, b[name]); | ~^~~~~~ | | | double bubblesort.c:6:42: note: expected ‘double *’ but argument is of type ‘double’ 6 | void bubbleSort(int n, char name, double a[20])
s
So I need to set this to double and the other one with &?
klimi
So I need to set this to double and the other one with &?
have you written that bubblesort by yourself? it seems you lack basic understanding of C; bubbleSort(n,name, b[name]); -> b[name] is double, you want array => you don't specify the item => sort(n,name,b) learn basics first
s
it is harder than it looks like
Nir
is there a library for c++ to develop a telegram bot
Nir
Yes
GitHub?
klimi
GitHub?
something like https://github.com/reo7sp/tgbot-cpp ?
Dima
something like https://github.com/reo7sp/tgbot-cpp ?
tdlib or this one tdlib has wider features
Dima
I think, because its not just for developing bots, but also user clients
Anonymous
how does it work when lambda function is passed to function as an argument?
Anonymous
how does it work when lambda function is passed to function as an argument?
The same way it works when variables are passed as an argument.
Pavel
how does it work when lambda function is passed to function as an argument?
lambda is an object of a generated class, every captured value is a member of that class. So that object is passed. Try cppinsights.io to see it yourself
Pavel
"generated" may not be a correct word here, but not sure what is correct
labyrinth
i saw this snippet using Ptr = typename Base::template immutable_ptr<Derived>; could anyone explain the ::template thingy?
Pavel
i saw this snippet using Ptr = typename Base::template immutable_ptr<Derived>; could anyone explain the ::template thingy?
I guess this was inside a template class or function? As far as I understand this is needed when you use a type that is dependent on the templated type. Basically you say, "yeah, I know this type/member/function is not visible here, but I promise the Base class will have it, so pls don't complain about this during syntax checking (first part of two-phase lookup)".
labyrinth
I guess this was inside a template class or function? As far as I understand this is needed when you use a type that is dependent on the templated type. Basically you say, "yeah, I know this type/member/function is not visible here, but I promise the Base class will have it, so pls don't complain about this during syntax checking (first part of two-phase lookup)".
https://stackoverflow.com/questions/610245/where-and-why-do-i-have-to-put-the-template-and-typename-keywords in the template keyword section, can it be boiled down to a hint to avoid ambiguity with '<' that arises from template programming 😂 back to the using Ptr = typename Base::template immutable_ptr<Derived>; it seems no ambiguity to me if I just say using Ptr = typename Base::immutable_ptr<Derived>;
Identity
b. Create a member function bottom() for the Stack class that returns the bottom element of the stack. c. Repeat part b, but for a function bottom() that is neither a member function nor a friend function of the Stack class.
Identity
I need a clarification on question c....If I create a normal function and parse the object of class stack would it justify the question c.
post
Hi, can I ask a question about rvalue & lvalue ?
post
why a+=b return lvalue, but a+b return rvalue ?
klimi
why a+=b return lvalue, but a+b return rvalue ?
a += b returns lvalue because you add b to a, in a+b you have new memory
Pavel
why a+=b return lvalue, but a+b return rvalue ?
As klimi said, a+=b returns reference to a, a+b returns reference to a temporary
Hesh
What is one-byte floating point notation ?
● Igor
Nowadays would be viable to code NES games using C with a bunch of optimizations, or assembly still the best choice?
Nada
i have this function SaveAsString(ofstream& outfile) {// code} and i want to call it how ?
Nada
i mean if it was SaveAsString(int save ) {// code} it will be SaveAsString(int s );
● Igor
the NES didn't get any update yet 🤷‍♂️
yeah, i mean the compiler nowadays compared to 80s
chakiwinja
yeah, i mean the compiler nowadays compared to 80s
had to look it up becouse I didn't remember the name, there's a c compiler that targets 6502 called cc65, you could try that
ScArY
Hii, Friends please send me basic C program Notes pdf.
Chat Boss
99 sent a code, it has been re-uploaded as a file
Mahmoud
check the file
Chat Boss
Dm sent a code, it has been re-uploaded as a file
Anonymous
Dm sent a code, it has been re-uploaded as a file
is there better way to make tribonacci sequence?
Jose
Nowadays would be viable to code NES games using C with a bunch of optimizations, or assembly still the best choice?
In a system with little resources as the NES, the usual approach is using ASM because you haven't enough ROM or enough RAM to create anything viable (further than little examples). The same approach goes to using C instead of ASM in old microcontrollers, just like Pic or Avr. Using modern approaches (for example, using a bank loader to switch rom banks), you can increase easily the rom needed and you can use C code with the benefits of using it (more features, more content). Trying to create "visual hacks" like 80s guys in NES games (aka sprite multiplexing) is not easily doable using C (because there aren't optimizations so deep to achieve the ASM equivalent). I encourage you to do it and prove I'm wrong (I hope I will be wrong!)
Dm
Dm sent a code, it has been re-uploaded as a file
As I know the Fibonacci sequence has only positive members so you used int64_t to store bigger numbers. Why not uint64_t? (I discuss this topic later) You can rewrite this with constexpr which can help you to avoid calculation in runtime for constants (if you want try this keep in mind what standard do you use). if you are so worrying about calculating the huge Fibonacci numbers, then add a check for variable overflow (assert or just if). For int64_t the latest index is 93. The 94 Fibonacci number will overflow int64_t. (In your case, it is 94, and in the official Fibonacci sequence it has an index of 93) Using uint64_t allows you calculate 1 additional number than it also will overflow. You can also try to get better result with using multiple threads and it will be challenging to write fast enough version of Fibonacci sequence calculator.
Suraj
What is recursion in c
M O H I T
What is recursion in c
Recursion is the technique of making a function call itself.
Suraj
Using recursion
M O H I T
Can you give me example in code in c
int sum(int k); int main() { int result = sum(10); printf("%d", result); return 0; } int sum(int k) { if (k > 0) { return k + sum(k - 1); } else { return 0; } }
Your senpai : )
what difference between full playlist and learn in hours programming lecture videos?
chakiwinja
on youtube
I think there's no real difference between a single, hours long video and multiple, smaller videos grouped in a playlist, depends on your preference and time availability, you can split the long one easily if you need a break since youtube will continue where you left anyway, so the only real deciding factor is the quality of the lecture
chakiwinja
I doubt it honestly, the material should be pretty much the same
Saurav
Please help me in finding the sum of the given series: 1 + a^2/2! + a^4/4! + a^8/8! + ............ Till nth term In C++.
Saurav
Chat Boss
so algorithm?
Saurav Shri sent a code, it has been re-uploaded as a file
Saurav
have a look my code
I'm not getting the right results 😔.
Arvin
have a look my code
I believe the problem is on the f
Arvin
I suggest making a function for factorial first
Arvin
int fct(int a){ if(a == 0) return 1; else return a * fct(a - 1); }
Arvin
then we use fct(pow(2,i)) for the f
Arvin
then we use fct(pow(2,i)) for the f
eh, variable f should be in type int then 😅 nevermind which one you prefer, double the function or int the variable
Saurav
eh, variable f should be in type int then 😅 nevermind which one you prefer, double the function or int the variable
Oh! Okk let me try doing the same as you suggested. And before this program I've used f as double in other series those were working fine.
Arvin
🙂🙂
Saurav
Arvin
glad if it helps 👍🙂
Saurav
glad if it helps 👍🙂
Yes the code is working now 😊😊
Anonymous
Hello everyone, it's there any software that allows to practice embedded systems without having any external physical material ( Arduino..)
Anonymous
yep
Which software?