• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 240
  • 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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