The copyto!() is an inbuilt function in julia which is used to copy all elements from the specified collection src to array dest .
Syntax:
copyto!(dest::AbstractArray, src)
Parameters:
dest::AbstractArray: Specified destination array.
src: Specified source collection.
Returns: It returns the copied elements from the specified collection src to array dest .
Example 1:
a = [1, 2, 3, 4, 5];
b = zeros(8);
copyto !(b, a);
println(b)
Output:
Example 2:
a = [1., 2., 3., 4., 5.];
b = ones(8);
copyto !(b, a);
println(b)
Output:
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!
Last Updated :
01 Apr, 2020
Like Article
Save Article