C++ Program - Sajha Mobile
SAJHA MOBILE
C++ Program
Posts 6 · Viewed 6619 · Go to Last Post
cp21
· Snapshot 131
Like · Likedby · 0
Please need help on this project
alece
· Snapshot 203
Like · Liked by · 0
Hah! just realized i forgot to do the average part. Hope you can figure that out.
kb3292
· Snapshot 282
Like · Liked by · 0
My friend, you can't "pass" arrays in c or c++, what is passed is pointers. Please read the c documentation or a good c book. The one by Dennis ritchie called "The C programming language" or something along that line is a pretty good one.
helpjava11
· Snapshot 367
Like · Liked by · 0
Not from C background but why not create a Global variable holding array and access it from any methods?
alece
· Snapshot 383
Like · Liked by · 0
@helpjava11..
coz global variables are bad ?
kb3292
· Snapshot 414
Like · Liked by · 0
Help java,global variables in general are a easy way to cope out. Although it may seem easier because you don't have to pass around information between methods, they are dangerous and can potentenially lead to unintended consequences. It could be okayto use for a tiny little program like this just for demonstration. Just like I mentioned earlier there are too many ways to do this. The original poster was asking how to "pass" arrays in functions. That's why I had to show that you can't pass arrays in c. You pass the address of the first index or the row depending on the dimension of your arrays. Pointers are the way to communicate between functions in c. Global variable are not recommended
Please log in to reply to this post

You can also log in using your Facebook
View in Desktop
What people are reading
You might like these other discussions...
· Posts 4 · Viewed 286
· Posts 6 · Viewed 416
· Posts 8 · Viewed 1265 · Likes 3
· Posts 9 · Viewed 510
· Posts 1 · Viewed 179
· Posts 12 · Viewed 945 · Likes 1
· Posts 1 · Viewed 79
· Posts 1 · Viewed 91
· Posts 9 · Viewed 1092
· Posts 1 · Viewed 125



Your Banner Here
Travel Partners
Travel House Nepal