![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| adding values with a loop | hcclnoodles | Shell Programming and Scripting | 1 | 05-27-2008 07:42 AM |
| While loop with Multiple variables | amit1_x | Shell Programming and Scripting | 4 | 04-02-2008 07:35 AM |
| using variables outside a while loop | Tornado | Shell Programming and Scripting | 2 | 02-09-2007 01:26 AM |
| Writing to variables within a loop | Sniper Pixie | UNIX for Dummies Questions & Answers | 0 | 03-02-2006 09:11 AM |
| for loop with multiple variables ? | fosterian | Shell Programming and Scripting | 3 | 03-01-2004 05:15 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
adding variables for, for loop
I have a structure which contains n number of elements. For example:
stFruits : apple, grapes, strawberry, pear, kiwi, melon, papaya, mango, orange, sweetlime ..... etc Now i have to write a for loop as follows: int i; int j; j=stFruits.apple+stFruits.grapes+stFruits.pear+.... and so on... for(i=0;i<j;i++) { } What i would like to know is , is there an other way to represent the sum of all elements in the structure instead of adding in the above way??? Iam very new to Programming... and hope to get an answer... |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|