Anonymous
mk
Abhishek
Can doubly linked list implemented using single pointer ?
Igor🇺🇦
Can doubly linked list implemented using single pointer ?
https://en.wikipedia.org/wiki/XOR_linked_list
Anonymous
hai
Ihor
Packages in Java is a files with main? or without main, just simple file
Anonymous
Hello
Anonymous
s=a+b+c/2; is wrong. it's supposed to be s=(a+b+c)/2.0
Anonymous
and what you implemented is called Heron's formula
Anonymous
Anyone using atom ide ? plz reply need help
Anonymous
Yeah
i pm you
Programmer
Thanks
👍🏻👍🏻
mahdi13
hi in vs code when i run the code i see just output is there a way to see compile time?
g3rm4n
hey everyone, i need to write a C recursive function to square each number in array...
g3rm4n
i know how to square a given number but i was stack of calling to array
j
vector<vector<int>> getAdys(vector<vector<int>> cities, int n){ vector<vector<int>> v(n,vector<int>()); for (int i=0; i<cities.size();i++){ v[cities[i][0]].push_back(cities[i][1]); v[cities[i][1]].push_back(cities[i][0]); } return v; }
j
i get a segmentation fault
j
exactly at the point of the first push_back
j
why?+
j
I wanted empty inner arrays
Pavel
I wanted empty inner arrays
Is your cities vectors filled correctly?
Pavel
I mean you address them by indexes 0 and 1 but are they filled?
j
yes, i filled them manually
j
vector<vector<int>> cities = {{1, 2},{3, 1},{2, 3}};
Anonymous
you declared the distance function ( float , float , float , float ) although you are passing only two floats , a=distance(x_1,y_1) its missing two more arguments . extern float area,x1,y10,x2,y2,x3,y3 also throws an error.
Pavel
yes, i filled them manually
Another question: you pass n as argument, to init v vector and then address it with values from cities? Is it checked that n is always greater (at least by one) than the maximum value that can be found in cities?
j
that's it
j
ty
Anonymous
you declared the distance function ( float , float , float , float ) a=distance(float , float ) its missing two more float arguments
Junaid
undefined reference to `WinMain'
Junaid
what does this means
Junaid
\collect2.exe [Error] ld returned 1 exit status
Junaid
what does this means
Anonymous
Try to Google
Junaid
#include<stdio.h> int leftrotate(int a[],int n){ int temp=a[0],i; for(i=0;i<n;i++){ a[i-1]=a[i]; } a[n-1]=temp; } int leftrot(int a[],int n,int d){ int i; for(i=0;i<d;i++) leftrotate(a,n); } int mian() { int a[5]={1,2,3,4,5},d=2; leftrot(a,5,d); return 0; }
Junaid
Try to Google
i had but can't understand
Anonymous
You have no int main() function
Junaid
You have no int main() function
thanks i got it main& mian
Mateo
ahh the mian cat
Mateo
Leon
Anonymous
Hey .Write a program to input Marks of 50 students and display marks of top 3 students. What will be the condition for second and 3rd student . while solving without using array
Anonymous
Hey .Write a program to input Marks of 50 students and display marks of top 3 students. What will be the condition for second and 3rd student . while solving without using array
That's stupid, you SHOULD sort an array for a problem like that! Otherwise it would look similar to this: https://nekobin.com/mobifaloka
Anonymous
Think of it as updating a high-scores list.
Anonymous
That's stupid, you SHOULD sort an array for a problem like that! Otherwise it would look similar to this: https://nekobin.com/mobifaloka
sorting in array is the easiest but the requirement of question is to find without using array.
Anonymous
It would be better to start iterating at int i = 3 but still rearranging x, y, z.
Anonymous
I need help using dspic30f4011 i2c
Anonymous
Anyone can help me out?
Anonymous
Anyone can help me out?
We don't know anything about it. All that the search results say is that it is a microchip that controls a blinking LED, programmed with the "Mplab software & Microchip C30' compiler.
Thierry
Is there a c(99) repl shell? like cling for c++
Anonymous
I'm not sure if this is what you mean... I never got this to work BTW. https://securityonline.info/wcc-the-witchcraft-compiler-collection/
Thierry
What's the benefit of writing a simple for loop in C like this long j; for (j = 0; j < N; j++) { // some computation } Instead of for (long j = 0; j < N; j++) { // some computation }
Thierry
Why, my professor is doing it and he's been coding C since 30 years
Anonymous
Whatever, it doesn't mean your professor good
Anonymous
Lol, learn some English...
Thierry
No need to be cocky
Elijah
for this long j; for (j = 0; j < N; j++) { // some computation } // some computation with j is possible while this for (long j = 0; j < N; j++) { // some computation } // some computation with j yields an error // j is block scoped in the loop
Anonymous
What's the benefit of writing a simple for loop in C like this long j; for (j = 0; j < N; j++) { // some computation } Instead of for (long j = 0; j < N; j++) { // some computation }
Declaring j before using it in the loop will allow it to be accessed outside the loop is for any reason you would like to use it again. When j is declared in the loop, it becomes bounded to the loop thus an automatic variable and memory space for it will be deallocated once loop exit. No more j after loop.
Thierry
Thanks 👍 this is what elijah pointed out
MᏫᎻᎯᎷᎷᎬᎠ
What's the benefit of writing a simple for loop in C like this long j; for (j = 0; j < N; j++) { // some computation } Instead of for (long j = 0; j < N; j++) { // some computation }
If you want to preserve the value of j for further use, it's okay Usually best practices with loops local variables are to be scoped inside the loop as much as possible, because it will make your function more clear and reduces the stack memory of the function (because the loop variables ends its scope once all the loops finished) so you won't get any useless extra space for your program
Anonymous
Hello, must I define a default constructor for a class if for some reason it I create a constructor with parameters and would use it for just special cases? Like for the default constructor, I create a prototype in class without ever defining it?
MᏫᎻᎯᎷᎷᎬᎠ
Hello, must I define a default constructor for a class if for some reason it I create a constructor with parameters and would use it for just special cases? Like for the default constructor, I create a prototype in class without ever defining it?
Well In my opinion You would use default constructor in case you want some default state of your object (class fields), and another constructor to set a way of how your initialized object works
MᏫᎻᎯᎷᎷᎬᎠ
Sometimes you would use constructor with parameters just to avoid calling the class setters later
MᏫᎻᎯᎷᎷᎬᎠ
Thanks for the answer
You're welcome
Anonymous
👌👌