?
Solved

writing a nested loop structure

Posted on 2000-03-01
1
Medium Priority
?
258 Views
Last Modified: 2010-04-15
Consider the two-dimensional and one-dimensional array structures defined below:

           double table[5][5]=
             {
                { 3, 4, 5, 6, 3},
                { 2, 1, 2, 1, 1},
                { 3, 2, 1, 4, 9},
                { 1, 0, 0, 1, 1},
                { 9, 2, 6, 4, 9},

             }

           double lst[5] = {2,1,2,3,4};

I need to write a nested for loop structure to subtract the array lst from each row of the two-dimensional array table. for example, after completion, the first row of table will be 1,3,3,3,-1 since 3-2=1, 4-1=3, 5-2=3, 6-3=3, 3-4=-1
0
Comment
Question by:beachbumm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 16

Accepted Solution

by:
imladris earned 75 total points
ID: 2573000
int i,j;

for(i=0; i<5; ++i)
{   for(j=0; j<5; ++j)table[i][j]-=lst[j];
}
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question