Readit News logoReadit News
nadavision commented on Everything I wish I knew when learning C   tmewett.com/c-tips/... · Posted by u/bubblehack3r
nadavision · 3 years ago
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]); } "

nadavision · 3 years ago
Thanks for all the great answers. The inconsistency between pointer deceleration and dereference syntax was what got me. :)
nadavision commented on Everything I wish I knew when learning C   tmewett.com/c-tips/... · Posted by u/bubblehack3r
nadavision · 3 years ago
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]); } "

nadavision commented on Mouse embryo with brain and beating heart created from stem cells   cambridgeindependent.co.u... · Posted by u/Tozen
nadavision · 3 years ago
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
nadavision commented on A meteor or alien tech: Harvard professor plans UFO expedition   nbcboston.com/news/local/... · Posted by u/metadat
nadavision · 3 years ago
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.

u/nadavision

KarmaCake day145May 28, 2022View Original