   value passing
  let's assume that i have that pseydocodechar x[..][..]= {...}f(int a, int b) {...x[1][1]=1...}int main() {...f(a,b)print x[1][1]}what is going to print?? the changed value or the initial one?? if i want the changed one, how can i write it? (the array isn't mentioned in the arguments)my programme is in c..offtopic: how do i use code tags..?   
  Code tags are either  or [ source][ /source] without the spaces. To answer your question you need to pass a pointer to the values you want changed. In that example you are passing the parameters a and b by value which means that the ones passed in are essentially copied for the function and when modified do not change the external variables.You need to do something like this:void SetValueTo2(int* pA){  *pA = 2;}int a = 0;SetValueTo2( &a );Here you are passing the address of an integer to the function and inside the function you are saying set the integer that the pointer points at to 2.   ;  In your example, "x" is a global variable.  You are not passing any copies of it into the function "f."  Instead, "f" is manipulating "x" directly.  So it will print the modified value.   ;  thanks.. i didn't change anything and it printed the changed ones, that i wanted.. for some reason this didn't happen a minute ago.. anyway it's working now..i have another one question:i think that there is a function that generates random numbers..what i want to do is this..set an array with 4 characters (a,b,c,d) and then have a function that chooses randomly one of them..?? can i find it in the library or i have to construct it myself?   ;  Moving to For Beginners.   ;Quote:Original post by ghostrider_thanks.. i didn't change anything and it printed the changed ones, that i wanted.. for some reason this didn't happen a minute ago.. anyway it's working now..i have another one question:i think that there is a function that generates random numbers..what i want to do is this..set an array with 4 characters (a,b,c,d) and then have a function that chooses randomly one of them..?? can i find it in the library or i have to construct it myself?Generate a random number from 0 to the number of elements in the array. Something like Array[Rand(0, Array.Count)]; in psuedocode.   