Login or Sign Up
Logging in...
Remember me
Log in
Or
Sign Up
Forgot password or user name?
Log in with
Search in titles only
Search in C only
Search
Advanced Search
Forums
BYTES
Product Launch
Updates
Developer Toolkit
Today's Posts
Member List
Calendar
Home
Forum
Topic
C
class and objects
Collapse
X
Collapse
Posts
Latest Activity
Photos
Page
of
1
Filter
Time
All Time
Today
Last Week
Last Month
Show
All
Discussions only
Photos only
Videos only
Links only
Polls only
Events only
Filtered by:
Clear All
new posts
Previous
template
Next
amir nazir
New Member
Join Date:
Sep 2018
Posts:
1
#1
class and objects
Sep 14 '18, 04:20 AM
how can i simply pass an array from constructor without using pointers?
weaknessforcats
Recognized Expert
Expert
Join Date:
Mar 2007
Posts:
9214
#2
Sep 16 '18, 03:49 PM
Use a vector. Have the constructor return a copy of the vector.
True, the vector may use pointers but that's not your problem.
You could also return an object that you design that contains the array. However, you will just duplicate code in vector.
Read this:
https://bytes.com/topic/c/insights/772412-arrays-revealed
Comment
Post
Cancel
Previous
template
Next
Working...
Yes
No
OK
OK
Cancel
👍
👎
☕
Comment