By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,603 Members | 1,422 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,603 IT Pros & Developers. It's quick & easy.

Can u pls help me??

P: 2
Hi everyone...
I have to write a program that initializes an array of 10 elements.Each element should be equal to its subscript.Copy this array to new one in opposite order.The program should print both arrays.
My english isn't perfect n' i have this assignment in english..
So help me pls...!!
Nov 12 '06 #1
Share this Question
Share on Google+
3 Replies


Banfa
Expert Mod 5K+
P: 8,916
This will require a few simple loops, you should attempt this question yourself first.

The code to set and array entry to it's own index value is

array[0] = 0;
array[1] = 1;
array[2] = 2;

or generalised to

array[i] = i;
Nov 13 '06 #2

100+
P: 141
hi,

the code for this is

for(i=0;i<10;i++)
a[i]=i;
for(j=0,i=9;j<10;j++,i--)
b[j]=i;
for(i=0;i<10;i++)
printf("%d",a[i]);

for(i=0;i<10;i++)
printf("%d",b[i]);





Hi everyone...
I have to write a program that initializes an array of 10 elements.Each element should be equal to its subscript.Copy this array to new one in opposite order.The program should print both arrays.
My english isn't perfect n' i have this assignment in english..
So help me pls...!!
Nov 13 '06 #3

P: 2
I thank u guyz...
Banfa u really helped me...
Nov 13 '06 #4

Post your reply

Sign in to post your reply or Sign up for a free account.