[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 236
  • Last Modified:

Thread able to view modifications within main program?

Hi,

I am implementing an array within the main program and I am implementing a separate thread. Say if the array is passed to the thread as an argument and the array is constantly being modified within the main program. Can the thread still see the modified data of the array at any time? For example,

array declared with values {5,34,6,3} initialized within main program

Thread now started and array passed as an argument to thread

array modifed to be {4,5,6,3,3,5,6}

If the thread accesses the array at this time will the thread be able to see the array with the new values?

Thanks
0
blaze_wk
Asked:
blaze_wk
  • 2
1 Solution
 
objectsCommented:
yes
0
 
objectsCommented:
both threads are accessing the same variable
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now