Crescenzo
I have to verify, but it is not accepted by the exercise..
Anonymous
Okay brother
Lelouch
/warn
klimi
Looooool
Crescenzo
klimi
^•^
Anonymous
I have to verify, but it is not accepted by the exercise..
Can we do like.. We have 2 pointers.. prev:- pointing to previous node next:- pointing to present node that is inputted through keyword and we can compare like If(next->data == prev->data +1)
Crescenzo
It could be a right solution, I went into hypnosis 🙂 I'll check!
Crescenzo
I'll let you know soon..
Dima
Anonymous
why is the j value 2 here? shouldn't it be 1? coz a[1] is 1 there and given statement is the post increment..so shouldn't the j value stay as 1?
Anonymous
i = ++a[1]; // i = 2, a[1] = 2 now
yeah i=2,but why does it effect a[1]? i is just a variable right? why would assigning a variable effect array element?
Oleksandr
yeah i=2,but why does it effect a[1]? i is just a variable right? why would assigning a variable effect array element?
array is just a pointer, so when u increment arr[index] u increment array element, not it's copy
Oleksandr
try to declare const int arr[5] ... instead of int arr[5] ... for better understanding
Oleksandr
okay... one more try int arr[2] = {1, 2}; // u create actually a pointer (int *) named arr, it //points to a //memory-area with size sizeof(int) * 2; int i = ++arr[0]; // here u just write this actually: int i = ++*(arr + 0); // so u increment variable, that locate at 'arr + 0' address
Anonymous
well thanks! that explains 😁
Marcio
Hi, i'm newbie
Anonymous
MᏫᎻᎯᎷᎷᎬᎠ
Sai Meghana
I ALWAYS get segmentation fault when i try to use 2D arrays or an array of strings. Any idea why?
Sai Meghana
int main() { int ele,i,n,q; int row,column; cin>>n>>q; int array[100][100]; for(i=0;i<n;i++) { cin>>ele; for(int j=0;j<ele;j++) { cin>>array[i][j]; } } for(int k=0;k<q;k++) { cin>>row>>column; cout<<array[row][column]; cout<<"\n"; } return 0; }
Sai Meghana
its sort of a 2D array but number of elements in each row is not the same.. the number of elements is the first input in each line which i've taken as ele
Sai Meghana
im supposed to do dynamic memory allocation but i dont know how to do that in 2D
Anonymous
Anonymous
Anonymous
Can anyone write the code to this program ina ny language
Andrea
no photo
klimi
My eeeyeeeees
I_Interface
/report read the rules
klimi
Well it is in the rules....
Anonymous
Ha ya
Anonymous
Can anyone write
Anonymous
Now we need it
Anonymous
Urgently
Anonymous
I can why?
Can u pls write
Oleksandr
im supposed to do dynamic memory allocation but i dont know how to do that in 2D
u first need to allocate array of type** than allocate N arrays of type*
Sai Meghana
is vector of vectors a good idea? if yes how do you implement it?
Anonymous
Code and send
klimi
Now we need it
Like in that java group someone is taking exams so they need solutions
klimi
I don't want to be coworkers with them
klimi
What a bs
klimi
Can u pls write
I already said I can
Andrea
Urgently
so you want us to do your homework, right now and for free? go away 😂
Sai Meghana
Oleksandr
im supposed to do dynamic memory allocation but i dont know how to do that in 2D
for example: //int arr[n][m]; int **arr = new int*[n]; for (int i = 0; i < m; ++i) arr[i] = new int[m];
Sai Meghana
whoops it took the asterisks as text formatting haha
Sai Meghana
int*[n] means pointer to an array?
I_Interface
int*[n] means pointer to an array?
It means array of pointers
Oleksandr
yeah, that was error; already fixed
Lelouch
klimi
so?
Its not homework
klimi
Its different
Sai Meghana
i thought "arr" was the pointer array..?
Andrea
Its not homework
of course its different but it is even worse then
Francisco
so?
If I get paid, I can do someone's homework no problem
Sai Meghana
sounds like a nice business
I_Interface
i thought "arr" was the pointer array..?
There's no 2d arrays in cpp, only array of arrays
Oleksandr
i thought "arr" was the pointer array..?
okay, first of all any array is just a pointer, so when u create int arr[10]; u just create int *arr; which points to the area with size of sizeof(int) * 10;
Anonymous
I already said I can
Pls send me code
I_Interface
sounds like a nice business
With vector of vectors u can create only nxn matrix
Andrea
If I get paid, I can do someone's homework no problem
but no one is offering money and also tey are asking to have a solution urgently
Sai Meghana
Francisco
I_Interface
but we can access a[i][j] right?
Yes, i - ur pointer array, j - element of yours array
klimi
Pls send me code
Stop it already