How does cudaMemcpyToArray function works? if cudaarray is 1D i understand what happens. but if i have 2d cudaarray i need t ospecify somehow pitch, but this function does not seem to take such argument. thank you.

Use cudaMemcpy2DToArray.

so cudaMemcpyToArray does not work with 2D? in programming guide there is a fragment of code where it is done.
how to use cudaMemcpy2DToArray? there is no info or sample.

There is info. If you have a tookit, you have both a pdf called the CUDA reference guide, and doxygen versions of the same information which can be viewed in a web browser. Full documentation of every API function is given there.

Thank You for info. Can you explain please how does cudaMemcpyToArray works?