Anonymous
Alright
Too lazy to explain
V01D
Mk
Anonymous
How to pass 2d array on c in a function? I looked or up on geeks for geeks but Hacker rank shows error that way
arrays decay into pointer to first element. int a[2]. type int[2]. decays into int *. int b[2][3]. type int[2][3]. decays into int (*)[3] (pointer to int[3]) when writing function parameters - int * and int [] mean the same thing, so do int [][3] and int (*)[3]
Vlad
Or you pass int**
Vlad
And have fun setting up array of pointers
Anonymous
Does every C++ program has a cmake file?
Anonymous
can't you just run the .cpp file and that's it?
Anonymous
asking for a friend
Anonymous
And have fun setting up array of pointers
Anonymous
what the hell is even a cmake file
Anonymous
Im asking because I use Clion and I don't even look at that
Anonymous
cmake is a cross platform builder
Anonymous
great now Imma google what's a builder
Anonymous
g++ -o a a.cpp
Anonymous
Are there any big cows here?
Anonymous
Are there any big cows here?
I'm from argentina
Anonymous
a lot of big ass cows here
Anonymous
I come from China
Anonymous
Back to Chinese!
Anonymous
You guys actually made a deal with us to raise pigs here
Anonymous
nvm back to C++
Anonymous
Sorry.. I’m not good at English... It’s hard to communicate with you
Anonymous
srs
Anonymous
no one know how complex.h in C has an operator overload on multiplication ?
Anonymous
its gotta be the only type with an operator overload
Anonymous
I find that you are all amazing... I really envy you
Dima
Does every C++ program has a cmake file?
nope, depends on your taste. but cmake is popular
Anonymous
Are there any partners willing to make Chinese friends!
Anonymous
1
Anonymous
Are there any partners willing to make Chinese friends!
I think one my tg friend but I don't know if he will ya not
Anonymous
I think one my tg friend but I don't know if he will ya not
I added your friend, my dear friend.. You didn’t reply to me.. Thank you for being friends with me.. It’s just that my English is really bad. I’m sorry to reply to your message slowly
Anonymous
I think one my tg friend but I don't know if he will ya not
I'm talking with you while translating! If there is something you don’t understand, please don’t mind!
Anonymous
no one know how complex.h in C has an operator overload on multiplication ?
who would know an asnwer to a question like this in here?
Anonymous
Anonymous
who ?
Check pm
Anonymous
The header <tgmath.h> defines a type-generic macro for each mathematical function defined in <math.h> and <complex.h>. This adds a limited support for function overloading of the mathematical functions: the same function name can be used with different types of parameters; the actual function will be selected at compile time according to the types of the parameters.
Anonymous
https://en.wikipedia.org/wiki/C_mathematical_functions
Anonymous
I found this
Anonymous
thats just function overloading damn
Anonymous
https://stackoverflow.com/questions/30986638/how-are-complex-arithmetic-operators-implemented-in-c
Anonymous
"3 C does have operator overloading -- even before the C89 standard, it overloaded operators like +, -, *, and / for both integer and floating point operations. C does not have user defined operator overloading -- so there are just the fixed set of overloads defined in the standard and no way to extend them. C99 just extends the int/float overloading of operators to complex numbers. There's still no way for a program to extend the overloading beyond that specified in the spec. "
Anonymous
case closed
Sherlock
int findbeautiful(int n,int ar[2][],int d,int startindex)
Sherlock
see this is my function declaration and it says array has an incomplete element type
Sherlock
https://www.geeksforgeeks.org/pass-2d-array-parameter-c/
Sherlock
https://www.geeksforgeeks.org/pass-2d-array-parameter-c/
but if you see this link, the same method has been used
Indolent
bool operator == (Point point2) { return x == point2.x && y == point2.y; } // What's happening in the above line of code?
Stefan
Stefan
also, this is illegal in c++
Stefan
the same family of error in malloc with (void*) and pointer assignment
Anonymous
Hello I have a problem when I build my program error message appears and it is Itanium x86 was not found I use visual studio 2017 Enterprise
Anonymous
I downloaded all C++ packages But the same problem, I searched google but couldn't find a solution I want help from all of you, please =(
harry
/get ide
harry
cool visual studio as always
Asad
Recently, I discovered a lot of bugs in VS2019
olli
Recently, I discovered a lot of bugs in VS2019
If you do, please report them https://docs.microsoft.com/en-us/visualstudio/ide/how-to-report-a-problem-with-visual-studio?view=vs-2019
Sherlock
you dont because of array decaying
It seems a bit difficult topic to understand so just tell me the right syntax to ease it, my number of rows will always be 2 and n will be number of columns, now how should I proceed?
Stefan
so that could easily give you a segfault
Sherlock
don't get it
Sherlock
any examples or link that I could read from?
olli
see this is my function declaration and it says array has an incomplete element type
there is a difference between ar[2][] what you did and arr[][2] what is used in the article In the later arr is an array of array 2 of int, in the first case ar is an array 2 of array of int, but how many ints are there in your array? This information is needed In regards to decay, when passing an array to a function the usual array to pointer conversion is performed, so the type of the array in the function is int (*arr)[2]
Andrew
writing arr[i][j] is same as writing *(*(arr+i))+j)
Andrew
a 2d array is an array of pointers, a 3d array is an array of pointers of pointers and so on
Shre
Hi
布丁
a 2d array is different from an array of pointers
布丁
It is just the same as 1d array w.r.t memory layout
Andrew
not really a 1d memory array you can see it as a single pointer
Andrew
position of at adress of pointer there is first element
Andrew
at adress of pointer+1 there is second element
Andrew
and when you write int arr[i] you are telling the debugger to, display the content of the address of arr+i where arr is the pointer