News for hackers. Stuff that matters.

nadavision

Re:Everything I wish I knew when learning C on Monday November 28, 2022 @08:58AM (#33773690)
Thanks for all the great answers. The inconsistency between pointer deceleration and dereference syntax was what got me. :)
Re:Everything I wish I knew when learning C on Monday November 28, 2022 @08:26AM (#33773339)
Thanks for submitting this. I'm teaching myself C so these high level overviews are super useful for improving my intuition. In the following example, shouldn't there be an asterisk * before the data argument in the getData function call? The way I understand it the function is expecting a pointer so you would need to pass it a pointer of the data object.

> "If you want to “return” memory from a function, you don’t have to use malloc/allocated storage; you can pass a pointer to a local data:

void getData(int *data) { data[0] = 1; data[1] = 4; data[2] = 9; }

void main() { int data[3]; getData(data); printf("%d\n", data[1]); } "

Sounds really cool. Can someone smarter than I explain what are the main differences between this and the recent study carried out at the Weizmann Institute of Science? Is it mostly the successful development of the brain? - https://www.jpost.com/science/article-713690
Unrelated to the contents on the article but the wording of the title made me think that the Harvard Professor crashed into the Pacific Ocean. You might want to consider clearing it up.
Re:How many decimals of pi do we need? (2016) on Sunday July 03, 2022 @05:15AM (#31966318)
Obligatory "there truly is an xkcd for everything."