anonymous
  • anonymous
Consider the following c program #include #include void get_forest(int *str); main() { int field[80][80],i,j; for(i=0;i<80;i++) for(j=0;j<80;j+) field[i][j] = rand()%2; get_forest(field); } void get_forest(int *str) { printf("%d",*str); printf("%d",*(str+4)); } It seems that in get_forest the second print command cant print the actual value that means in this case field[3][0].How can I fix it?
MIT 6.00 Intro Computer Science (OCW)
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
schrodinger
  • schrodinger
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
anonymous
  • anonymous
Python class, bro... Anyway, I think the second line would print out field[0][4]. If you want to print field[3][0], why not just replace that print statement with cout<
anonymous
  • anonymous
Thanks bro but I was wanting to do it with c and the Borland compiler did not give that expected result and I just want to know how I can access a string from another function using pointer arithmatic
anonymous
  • anonymous
Try using a one-dimensional string Not sure how it would interpret pointer arithmetic in a 2D array, but did you try printing *(field+3*80) ?

Looking for something else?

Not the answer you are looking for? Search for more explanations.

More answers

anonymous
  • anonymous
Thanks for that

Looking for something else?

Not the answer you are looking for? Search for more explanations.