Anonymous
/get cppbookguide
Ehsan
Ehsan
then initilize a counter with the value 0 for each condition
Parra
in cmake, do you know how to tell to add_custom_target to watch for changes only in specific files for triggering the build? like how a add_library does with sources, but with custom files
MᏫᎻᎯᎷᎷᎬᎠ
.
AHMED
Is it important to learn c++ 20 features. They are very difficult.
AHMED
??
Pavel
Is it important to learn c++ 20 features. They are very difficult.
It depends. It is needed mostly of your team uses or plan to use C++20 heavily. It is nice to be prepared for the next years, or to show off with your C++ knowledge (in front of colleagues, on interviews, or in chats like this). In other cases, not sure if it's somewhat important.
Артём
I have a code snippet(written by me) I understand intuitively, but cannot figure out how to describe it with smartass words.
template<class> class myDelegate;
template<class Tret, class...Targs>
class myDelegate <Tret(Targs...)> { /*..CODE..*/ }
So I created a class which can be instantiated by function signature, like
myDelegate<int(float, char)> d;
Please help me to find correct words to explain why do we define the class like this (template written twice, the second time with the <> after name...)?
caesar
🍃⃪᪵᪳ ꯭꯭𝅥ٖٖٖٖٖٖٜٖٖٖٖٖ𝆬𝆺꯭꯭꯭𝅥𝆭👑pRiNcE v/s pRiNcEsS𝆺꯭꯭꯭𝅥𝆭👑᪵᪵᪳᪳𝄄꯭
Hi
Anonymous
Paying for a cpp program help
Hanz
Adams Scott
helllo
Anonymous
hello, what's up?
Igor🇺🇦
Yes
Integers don't store fractions. So what's your question about?
Anonymous
Some languages, like old-school javascript used floats for all numbers to be most flexible. But normal ints is what computers use best.
Anonymous
Why doesn't anyone want to chat? :(
#include <stdio.h>
int main() {
unsigned long long one = (unsigned long long)1.0e10;
unsigned long long pi = 0;
for(int i = 33; i; i--) {
pi = 2*one + (i * pi / (2*i + 1));
}
printf("%llu\n", pi);
return 0;
}
Anonymous
#include<stdio.h>
#include<stdlib.h>
int i,n;
int largearr(int *);
int main()
{
int k;
int *a;
printf("Enter the size of the arrays\n");
scanf("%d", &n);
a = (int *)malloc(n * sizeof(int));
for (i = 0; i < n; i++)
{
scanf("%d", a + i);
}
k=largearr(a+i);
printf("Largest element = %d",*k);
return 0;
}
int largearr(int *c)
{
for (i = 1; i < n; ++i)
{
if (*c < *(c+i))
*c = *(c+i);
}
return *c;
}
Guys can anybody rectify where i did wrong i want print largest number in an array using pointers and function includes malloc ?
Anonymous
#include<stdio.h>
#include<stdlib.h>
int i,n;
int largearr(int *);
int main()
{
int k;
int *a;
printf("Enter the size of the arrays\n");
scanf("%d", &n);
a = (int *)malloc(n * sizeof(int));
for (i = 0; i < n; i++)
{
scanf("%d", a + i);
}
k=largearr(a+i);
printf("Largest element = %d",*k);
return 0;
}
int largearr(int *c)
{
for (i = 1; i < n; ++i)
{
if (*c < *(c+i))
*c = *(c+i);
}
return *c;
}
Guys can anybody rectify where i did wrong i want print largest number in an array using pointers and function includes malloc ?
Variable k is a regular int, not a pointer. If that even compiled it would probably crash... The prefix-star syntax is used with pointers.
Oh, variable i is used outside of the for loop...
The function largearr(), starts in the middle of array, not the beginning... It almost looks right, but should be written as:
int largest(int *arr, int len);
Anonymous
Anonymous
#include<stdio.h>
#include<stdlib.h>
int i,n;
int largearr(int *);
int main()
{
int k;
int *a;
printf("Enter the size of the arrays\n");
scanf("%d", &n);
a = (int *)malloc(n * sizeof(int));
for (i = 0; i < n; i++)
{
scanf("%d", a + i);
}
k=largearr(a);
printf("Largest element = %d",k);
return 0;
}
int largearr(int *c)
{
for (i = 1; i < n; ++i)
{
if (c < (c+i))
c = (c+i);
}
return *c;
}
Kirill
can you please use pastebin or something?
Anonymous
pastebin?
Kirill
yes
Kirill
## Rules #pinned
* You are not entitled to an answer, getting angry about not answered questions will get you warned.
* Not checking your problem in google (or any other search engine) first will get you a warn.
* Asking to solve an assignment/test/whatever without trying it first yourself will get you a warn or will get you BANNED. We won’t write a code for you, but we can push you forward and suggest something.
* Before posting a long code snippet think twice and read the Resources section below.
* No “best book” or “best youtube channel” requests, use /get cbook and /get cppbookguide chat commands.
* No “best ide” requests, use /get ide chat command to see the suggestions.
* Asking for something that is in the pinned message right after joining WILL GET YOU BANNED.
* C/C++ discussion preffered (assembly also allowed), asking about other languages (or groups for other languages) right after joining will get you BANNED.
* Reverse enginnering, hacking and related topics are allowed, but asking to hack facebook, instagram, etc. is NOT allowed. Also if you ask "how to become a hacker" and obviously have zero knowledge on anything related to that you may get warned or banned.
* Legitimate requests for help on code and programming questions are welcome. A request is considered legitimate if it describes your problem, what you've done so far and what went wrong. Requests such as "write my program" or "do my homework" are never considered legitimate. Asking not legitimate questions will result in a warn or ban. See https://stackoverflow.com/help/mcve on how to write good questions.
* Asking for book recommendations is ok, but "pls give pdf book" is not allowed, find books by yourself. Posting illegally copied books (or links to those books) is also not allowed and will get you BANNED.
* Only English language is allowed, if you speak shitty English or don't understand anything in English YOU WILL BE BANNED.
* A little bit of programming related memes, jokes, shitposting are allowed.
* NSFW content (porn, nudity, etc.) is not allowed.
* Spamming/advertising (job posts are also ads, so ask an admin before posting) will grant you a warning or an immediate ban if you do it right after joining.
* Religion, politics and ideological topics are forbidden.
* Long code snippets must be posted via a snippet website(links below), posting pictures of code and posting long snippets in the group is not allowed.
* If you encounter a problem, while using dev C++ or turbo C/C++, you will not be helped, use another more modern IDE.
* Don't post compiled executables, that is obviously a security risk.
* Personal messages without asking beforehand are not allowed.
* If you want to post a link or some article in this chat you will need an admin approval first
## Resources
C/C++ group India: http://t.me/c_cpp_india
About asking good questions:
* [English](http://www.catb.org/esr/faqs/smart-questions.html)
* [Translations](http://www.catb.org/esr/faqs/smart-questions.html#translations)
For posting long code snippets:
* [GitHub Gist](https://gist.github.com)
* [Ubuntu Paste](https://paste.ubuntu.com/)
* [Pastebin](https://pastebin.com)
## Reports
If you notice any forbidden content, please use the /report command while responding to the offending post to report it to the admins.
generally this
Anonymous
Kirill
because I still has to wait until I am permitted to post links
Anonymous
Anonymous
yes im practicing pointer which includes array and the use of malloc
Anonymous
@dixie_cup
Anonymous
Anonymous
Message from @xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx4
Hello EveryBody! I'm trying to get working container for libreofficeonline from collabora repository. It builds fine but when loading document from my wopi server it (loolwsd process) segfaults (https://paste.centos.org/view/6a7bc19a) when trying to open ssl socket. The question is: what's the recommended approach to segfaults debugging? curl from this container to the same wopi server via ssl succeeds.
Anonymous
Though I'm not sure it's ontopic here
Alpha Max
Alpha Max
Ehsan
Ehsan
T
is it possible to check invalid pointer at compile time?
Ehsan
I recommend you dump the core in gcc and debug it to see where it stopped
Ehsan
Ehsan
You have to explicitely assign the pointer to nullptr and check it later
Generation Z
Hola i got an error in Code::blocks ing me
“ERROR: You need to specify debugger in the debugger's settings.
(For MinGW compilers, it's 'gdb.exe' (without the quotes))
(For MSVC compilers, it's 'cdb.exe' (without the quotes))”
What does it mean and how do i solve the problem, am a beginner in cpp
MAC
labyrinth
anyone have a good reading resource of hazard pointer? preferably with graphical illustration because the original paper is too hard to understand for me, in a language point of view
Ehsan
labyrinth
I wanna be able to understand it. But the wordings in the paper too hard for me to understand. I can’t find a single resource with graphical illustration of the management process.
Ehsan
Ehsan
I think the best way to understand it is to look at codes implementation
Osama
can anyone explain c++ structured binding in simple words please?
Ludovic 'Archivist'
Vlad
Thailand import
Question 2
Write a C function named reverse()that reverses the words in a sentence.
Hint: See strtok() in String.h
Enter a sentence: you can cage a swallow can’t you
Reversal of sentence: you can’t swallow a cage can you
Thailand import
hello, why my code the reversal of sentence wont reverse?
Thailand import
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int reverse(char*str){
if(str){
reverse(strtok(NULL,"\t\n"));
printf("%s", str);
}}
int main(){
char string[90] ;
printf("Enter a sentence: ");
gets(string);
printf("Reversal of sentence: ");
reverse(strtok(string,"\t\n"));
}
⚛ Hz
Keyword: words
⚛ Hz
But you're using \t\n to split
Thailand import
which part need to change?
Diego
Thailand import
Keyword: words
hmm bro, i still cant get what you mean. whiich part
Anonymous
/get cbook
Bumpy
hello everyone
Bumpy
anyone know how can i setup clang to my VS code?
Bumpy
im using WSL
Henry
please can anyone recommend a youtube channel that offer C tutorial
Anonymous
Henry
I mean youtube channel not books
Henry
Sharif
Hi, I'm C++ beginner
I need help to understand below code:
#include<iostream>
using namespace std;
int main()
{
int x[6] = {19,10,8,17,9,15};
cout << "This numbers are: ";
for (int n:x){
cout << n << " ";
}
return 0;
}
Result will be as like as:
This numbers are: 19 10 8 17 9 15
But my CodeBlocks showing like that:
4354238 4354238 4354238 continue showing without break
Aakash
Anonymous
/warn chin pming
Ehsan
Anonymous
/warn @Hornet0101 pming