Pavel
Ohh I see
I think most compilers should have warnings for cases like this (probably not enabled by default)
Tttttttttttchjj Tottenham ggkffxxchj vghhggggggggggggggggggggggg
int main () { int a, b; a = b = 4; b = a++; printf ("%d %d %d %d", a++, --b, ++a, b--); } 5 3 7 3 5 4 5 3 6 2 6 4 Syntax Error
a Semicolon
char *copy ( char *, char * ) ; int main( ) { char *str ; char source[ ] = "Jaded" ; char target[ 10 ] ; str = copy ( target, source ) ; printf ( "%s\n", str ) ; return 0 ; } char *copy ( char *t, char *s ) { char *r ; r = t ; while ( *s != '\0' ) { *t = *s ; t++ ; s++ ; } *t = '\0' ; return ( r ) ; }
a Semicolon
the line *t='\0'; before return statement, I want to know how *t will still points to the last byte of memory in the char pointer outside the loop? I mean t++; is happening inside the while loop so how the value remains after the loop ends fot *t
Pavel
I always forget, is this one above defined in C++17? I mean the order of execution
𝙰𝚖𝚖𝚊𝚛
Good evening everyone In dart language there is an expression to return in function which make the code easier like int fun () => 1; Which means int fun () { return 1; } Is there any way to do that in c++ ? And is there any way to pass an optional parameter to functions in c++ too ?
Marcello
Hi guys
Marcello
One of you would help me?
Marcello
I have to write a programme where I'll create a array (MAX 10 for example) and the programme gives me back the first 10 prime numbers
Vlad
Just write a return lmao
Vlad
What is that array what's it for. And what have you done already
Marcello
Task is unclear
Array is a vettor he start from 0 to N-1 (sorry I'm italian)
Vlad
We won't do that for you, but we might suggest a solution
Marcello
I know
Vlad
If you know that it is a progression you would need only two numbers
Vlad
First and last
mov $22, %rax
DIO
Marcello
Marcello
Ho provato a fare come mi hai detto ma niente
mov $22, %rax
We
www.deepl.com
Marcello
Quindi sto chiedendo un po' di consigli per arrivarci
Vlad
Let's say it's an array of indeces of the prime numbers. Then you'd just loop over it and find a prime by that index
mov $22, %rax
Quindi sto chiedendo un po' di consigli per arrivarci
here they will ban you if you don't speak english
Marcello
Marcello
Create a vector of modulus 10 for example and I must get the first 10 prime numbers, if I declare the vector with modulus 20 then the program must give me the first 20 prime numbers
Vlad
What the actual heck is the vector of modulus 10?
Vlad
It makes zero sense
Marcello
Moduls is its greatness
Vlad
>greatness Laughing my ass out
Marcello
...
Vlad
Anyways you mean it's size?
Marcello
Yes
Vlad
for(int i = 0; i < vec.size(); ++i) { auto prime = NthPrime(i); }
Marcello
for(int i = 0; i < vec.size(); ++i) { auto prime = NthPrime(i); }
Ok, but I need that the program give me the first 10 prime numbers
Marcello
If the size is 20, I need the first 20 prime numbers
Vlad
Google up prime finding yourself
Marcello
Okok
Marcello
Thanks
Marcello
Now I'll try alone
Diego
Heeey I've got a question I'm working with platformio with an ESP32 (Arduino Framework) right now, and it seems that compilation is starting at the wrong file -- which should be fine, I trust the compiler knows its stuff... but then the definitions go and throw a bunch of issues because I've got some libraries which depend on user-defined symbols and they fail when the #include is hit at the wrong point, because it's defined in main.cpp Anyway I solved this by making the compiler ignore all files but that one, and include them through each file's #include directives BUT THEN As the libraries compile, the compiler complains that some header files are missing, and even though I checked and they were, in fact, PRESENT, it still complains and I don't know what to do
Diego
I'll post a link to imgur real quick
Diego
https://imgur.com/a/knFhWxE
Diego
Can anyone help?
Юрій
I`ve already found a solution)
R
I`ve tried to make a md5 hash
ok, thanks i wanted to understand
Gulshan
#include <bits/stdc++.h> using namespace std; int main() { int n; cin>>n; int ans=0; for(int i=0;i<n;i++) { int x; cin>>x; ans^=x; // what do this mean ???? } cout<<ans<<endl; }
Sabuhi
Answer=answer^x maybe?
Gulshan
Try to Google
I searched about xor gate cpp code, but didn't found something like this
Gulshan
xor gate wat
a guy said on hackerearth that this is xor gate method
Gulshan
#include <bits/stdc++.h> using namespace std; int main() { int n; cin>>n; int ans=0; for(int i=0;i<n;i++) { int x; cin>>x; ans^=x; // what do this mean ???? } cout<<ans<<endl; }
People are using many techniques but i consider the easiest to be XOR gate.This question is meant to be solved using Xor gate. Here is my Code-
Anonymous
I searched about xor gate cpp code, but didn't found something like this
https://docs.microsoft.com/ru-ru/cpp/cpp/cpp-built-in-operators-precedence-and-associativity?view=msvc-160
Anonymous
Try learn Googling
Gulshan
Yeah, thanks 🤔🤔🤔
0xFF
ru-ru
Vlad
ru-ru
Quote of the day:
Anonymous
I'm getting warning: implicit declaration of function for function declarations that are already in header files that come with the compiler, I'm using, gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0 Copyright (C) 2019 Free Software Foundation, Inc.
Anonymous
Anyway to solve this or do I have to manually declare the functions in my file?
Anonymous
But works fine for, gcc (MinGW.org GCC Build-2) 9.2.0 Copyright (C) 2019 Free Software Foundation, Inc. In my Windows
Sabuhi
Can you send the header file and source file?
Anonymous
Can you send the header file and source file?
the header file from the compiler directory?
Anonymous
btw Im using WSL to compile my program