Amit
But in case of Entity e1("value");
Direct conversion is taking place.....hope I have understood it correctly?
Alex
︎ ︎ ︎ ︎ ︎ ︎ ︎ ︎ ︎ ︎ ︎ ︎ ︎ ︎ ︎ ︎ ︎ ︎ ︎ ︎ ︎ ︎
Marku
Alex
why? there is costructor with one argument
Alex
from your link:
struct Exp { explicit Exp(const char*) {} }; // not convertible from const char*
Exp e1("abc"); // OK
Exp e2 = "abc"; // Error, copy-initialization does not consider explicit constructor
struct Imp { Imp(const char*) {} }; // convertible from const char*
Imp i1("abc"); // OK
Imp i2 = "abc"; // OK
Alex
I see, sorry
Alex
he uses const char* instead of string
Amit
Yeah that's exactly I was searching for....copy intialization by c style char string while actually passing string type object in constr call.
The link clarified the doubt. Appreciated it👍
Pavel
I think it's more related to the fact that only one implicit conversion is allowed for a value in this case.
https://ideone.com/CFAwX8
Ariana
/ban @Brayannnnnnnnnnn asking for help during test in dms smhmh
Khai
/get ide
Noble Friend
Can someone help me with the equivalence of "windows.h" library in linux?
Noble Friend
i wrote something in C in windows but now in linux, it can't work. Please
Alex
what kind of functionality do you need?
Pritham
Thank you Rose
MᏫᎻᎯᎷᎷᎬᎠ
what const_cast really does?
Dima
Alex
remove const qualifier
MᏫᎻᎯᎷᎷᎬᎠ
I think I got it
MᏫᎻᎯᎷᎷᎬᎠ
thanks
Ajay
compiling with -ftrapv flag aborts the program, how to find the line on which abort is called?
Ajay
Before debugging, do I still need to compile with the -ftrapv flag?
Antonio
Thanks so much.
Anonymous
How to get an array of 10^9 or it's not possible ,,if vector then max size of vector??
Alex
Alex
or better type *val = malloc(sizeof(type) * 1000000000)
Alex
because of stack overflow
Alex
use new for c++
Dark
Sorry wrong chat
Anonymous
Anonymous
#include<iostream> // CODE for spiral print 2d array by SOURAV SINHA
using namespace std;
int main()
{
int val=0; // will be used to initialize the array
int rl,cl;
int arr[1000][1000];
cin>>rl>>cl;
for(int row=0;row<rl;row++)
{
for(int col=0;col<cl;col++)
{
val++;
arr[row][col]=val;
cout<<arr[row][col]<<" ";
}
cout<<endl;
}
int strow=0,endrow=rl-1,stcol=0,endcol=cl-1;
while(strow<=endrow && stcol<=endcol)
{
//printing start row
for(int i=stcol;i<=endcol;i++)
cout<<arr[strow][i]<<" ";
strow++;
//printing last column
for(int i=strow;i<=endrow;i++)
cout<<arr[i][endcol]<<" ";
endcol--;
//printing last row in rev
if(strow<endrow)
for(int i=endcol;i>=stcol;i--)
cout<<arr[endrow][i]<<" ";
endrow--;
//printing first col in rev
if(stcol<endcol)
for(int i=endrow;i>=strow;i--)
cout<<arr[i][stcol]<<" ";
stcol++;
}
}
Anonymous
the above code runs on online compiler but doesn't run on dev c. pls help
Sokka
How can I connect sqlite in c++ program?
.......
Anonymous
MrRobot
Hi
MrRobot
Whenever i try to use backdoor by dana_at_cp from github it always shows an error saying "failed to run baksmali on classes.dex r java class files"?
MrRobot
Please help me with this!
Rahul
Hey guys can you please help me out with , parenthesis problem using stack , i am unable to debugg it , please help me out
Rahul
Well , i am sorry for that .....i did the required changes but still problem remains the same , there is a problem in push function .
As i have initialized st-> top = -1, but st->top stores garbage value when push function is called .
Can you please tell me where i am lagging ?
And btw i am sorry for silly mistakes , well i am a newbie ...please forgive my mistakes .
Thank you !
Rahul
https://hastebin.com/raw/disowikusa
Rahul
What i am suppose to do 😭 , i am unable to debugg ?
Rahul
Thank you , and i am sorry to bother you again and again .
Andrea
if I created a pointer in the main and created a function to which I pass this pointer and in this function I use the malloc on the past pointer; why must the function have a pointer return type? why isn't it void? when I allocate memory dynamically the change should not be global?
Artöm
Artöm
In second variation return type can be anything
Andrea
so if i pass a pointer to pointer i am not forced to return anything?
Artöm
Yes
Artöm
Please find it yourself
Andrea
and why if i go alone in the pointer does it not act globally?
Artöm
I dont understand this question
Artöm
Wym by globally?
Andrea
when I act on the memory addresses the changes should be global .. I don't understand why if I pass a pointer and act on its addresses they are not global
Artöm
You mean changes in memory? They are global
Artöm
Global to your process (application that is) id say
Andrea
yes this yes, but passing a pointer do not work on its addresses? why these changes are not seen by the main?
Artöm
Are you talking about assigning something to a pointer variable?
Artöm
If you have
void f(int* a) {
a = whatever;
}
int* b;
f(b);
only a changes, because a is a copy of b. Changing a does not affect value of b
Andrea
ok .. so despite passing a pointer, the passage takes place by copy?
Artöm
Artöm
When one calls it pass by reference, referenceness is implied for memory pointed to, not for variable
Andrea
Of course
thank you very much.. now everything is clear
Andrea
Anonymous
😳
Noble Friend
/get cppbookguide
Noble Friend
/get ide
Anonymous
I currently use Dev C++
Should I move to Codeblock or any other text editor /IDE ?
Aman
void rearrange(int *arr,int l)
{
int temp1,temp2;
for(int i=0;i<l;i=i+2){
for(int j=i+1;j<l;j++){
if(arr[i]+arr[j]==0){
temp1=arr[j];
temp2=arr[i+1];
arr[i+1]=temp1;
arr[j]=temp2;
break;
}
}
}
return arr;
//Write code here, make changes in the same array
}
Aman
Compilation Failed
In file included from runner.cpp:2:0:
solution.h: In function 'void rearrange(int*, int)':
solution.h:17:12: error: return-statement with a value, in function returning 'void' [-fpermissive]
return arr;
^
Anonymous
Thanks
Aman
can anyone pls help me with that
Alpha
Good morning
.
Surdma
Aman
@Surdmanofficial thank u
Surdma
Tanay you're welcome