[ Nibble @ 10.01.2006. 17:20 ] @
Moze li mi ko uraditi bilo koja od ova 2 zadatka.Uradio bi ove zadatke ali nekontam kada trebam prebaciti npr double u unsigned char* i td. Evo Zadatka 1 Code: Create a function that takes a pointer to an array of double and a value indicating the size of that array. The function should print each element in the array. Now create an array of double and initialize each element to zero, then use your function to print the array. Next use reinterpret_cast to cast the starting address of your array to an unsigned char*, and set each byte of the array to 1 (hint: you’ll need to use sizeof to calculate the number of bytes in a double). Now use your array-printing function to print the results. Evo 2 Code: Define an array of int. Take the starting address of that array and use static_cast to convert it into an void*. Write a function that takes a void*, a number (indicating a number of bytes), and a value (indicating the value to which each byte should be set) as arguments. The function should set each byte in the specified range to the specified value. Try out the function on your array of int. [Ovu poruku je menjao Nibble dana 10.01.2006. u 18:20 GMT+1] |