Rajul
ok I will read
Alexzander
OFC he can use C for education for first time, but its too simple language
and it's hard languages if you make a hybrid app
Anonymous
int *a = (int *) new int[10];
There is no need to explicitly cast
😎
Hey any linux users?
🇰 🇷 🇦 🇹 🇴 🇸😜
#
Dima
/ban Weird stuff
Accel
int *a = (int *) new int[10];
You haven't cast to int*
Accel
Mine better 😜
Malloc returns void pointer so you have to cast
Anonymous
int *a = realloc(NULL, 10*sizeof(int)); a[9] = 228; int *a = realloc(a, 20*sizeof(int)); printf("%d", a[9]);
Anonymous
Accel
Its only for C++ code i think
No in c++ when you use new then you haven't cast it because we already mentioned it's type
Accel
But in case C when you use malloc,calloc or realloc you have to cast it
Accel
Till
And????? Cast is unnecessary In C enough int * a = malloc(5*sizeof(int));
Till
But in C++ you need cast, lol
Till
For new??
new is not a C-lang
Accel
Just talking about c++
Till
Lol I know
Lol, and what are you doing? You talk about C
Aidar
sup cppsach
Till
Give up that topic.....
Malloc in C++ is unnecessary, you need avoid it
Accel
Malloc in C++ is unnecessary, you need avoid it
I know I am familiar with the new :)
Accel
But topic about C
Yep... In c malloc is necessary
Aidar
Anonymous
Why c++is bottom up approach nd c is top-down?
Ariana
huh
Accel
😂😅
Anonymous
why this is not appending
Андрей
why this is not appending
ak->a[4] = 67;
Anonymous
Anonymous
(struct array ** ak) so that can we use this and ak.a[4]=67;
Anonymous
Why do you write it???
Anonymous
Why do you write it???
just exploring something
Anonymous
Anonymous
Anonymous
can we use **ak in place of *ak
Anonymous
Just delete this code
Anonymous
Just delete this code
answer the question
Anonymous
Explore how std::vector works
Андрей
Explore how std::vector works
I think he wants to write his own vector
Anonymous
bro i want to learn about **pointer
Anonymous
i have searched all places
Anonymous
but everywhere its not enough
Андрей
bro i want to learn about **pointer
In C++ you will rather use reference to pointer then pointer to pointer
Anonymous
ok
Dima
Lol
Anonymous
#include<iostream> using namespace std; void fun(int **sac) { } int main() { int arr1[2][2]={{1,2},{0,5}}; fun(**arr1); cout<<arr1[1][1]; }
Anonymous
i want to make this 0 as 4 using pointer
Anonymous
how can i do that
Magesh
arr1[1][1] is 5 as per ur initialized array and y u want to make arr1[1][0] which was 0 to 4 using double pointer if u are not going to do anything with it, just curious
Harsh
If your prototype has ** your answer is supposed to have '&arr1' right?
Anonymous
using namespace std; void fun(int **sac) { } int main() { int arr1[2][2]={{1,2},{0,5}}; fun(**arr1); cout<<arr1[1][0]; } i want to make this 0 as 4 using pointer how can i do that
Anonymous
i want to make this 0 as 4 using pointer
#include<array> template <std::size_t N, std::size_t M> void func(const std::array<int, N, M>& array) { array[1][0] = 4; }
Андрей
[In reply to Rextester] #include<iostream> void fun(int (&arr)[2][2]) { arr[1][0] = 4; } int main() { int arr1[2][2]={{1,2},{0,5}}; fun(arr1); std::cout << arr1[1][0]; }
Dima
o.O our bot can remove forwarded messages
Андрей
(tested in @rextester_bot)
Андрей
using pointer
in my code change & to *
Андрей
I think you can write something like int *arr, and then arr[2] = 4; but I don't sure
Harsh
using pointer
Try calling func as fun(&arr1); Then it makes sense to use double pointers
Anonymous
in my code change & to *
bro in place of[][] i want to use **
Андрей
Anonymous
i was not allowed to pass [][] in func
Anonymous
it was the question
Anonymous
i am allowed oly ** or *
Anonymous
with * i cannot change 2d array