int[, ,] array = { { { 1, 2, 3, 3 }}, { { 7, -1, 9, 0 } }, { { -1, 0, 7, 8 }
} }; // 3D
In the line of code above, am I using 'literal' syntax/notation to create
the array?
The rank of the array is 3, its dimensions are 3,1,4.
How would I change the code to produce
a. an array of dimension 3,2,4?
b. an array of rank 4?
Thanks. 22 4028
AA2e72E wrote:
int[, ,] array = { { { 1, 2, 3, 3 }}, { { 7, -1, 9, 0 } }, { { -1, 0, 7, 8 }
} }; // 3D
In the line of code above, am I using 'literal' syntax/notation to create
the array?
The rank of the array is 3, its dimensions are 3,1,4.
Hint: count '3' '1' '4'. It's equal to 3.
Another hint:
* What is there 4 of in the top example?
* Given that you've gotten what there's 4 of, what is there only one of,
for its given level of nesting?
* Can you spot what there's 3 of now?
How would I change the code to produce
a. an array of dimension 3,2,4?
b. an array of rank 4?
Do you own homework - it's not hard!
-- Barry
-- http://barrkel.blogspot.com/
Learn to read before jumping to prescribe.
My note says that I know the rank (number of dimensions) is 3; I go on to
tell you that the dimensions are 3,1,4. The question was how would I modify
the right hand side (RHS) such that the rank stayed as 3 but he dimensions
were 3,2,4 i.e how would I increase the second dimension to 1.
The second question was whether the RHS was a 'literal ' notation.
If you did not know, or cannot be bothered to understand what is written,
why do't you simply choose not to respond? Your answer adds nothing.
PS: I had bothered to research my own answers but came with nothing; hence
the post.
"Barry Kelly" wrote:
AA2e72E wrote:
int[, ,] array = { { { 1, 2, 3, 3 }}, { { 7, -1, 9, 0 } }, { { -1, 0, 7, 8 }
} }; // 3D
In the line of code above, am I using 'literal' syntax/notation to create
the array?
The rank of the array is 3, its dimensions are 3,1,4.
Hint: count '3' '1' '4'. It's equal to 3.
Another hint:
* What is there 4 of in the top example?
* Given that you've gotten what there's 4 of, what is there only one of,
for its given level of nesting?
* Can you spot what there's 3 of now?
How would I change the code to produce
a. an array of dimension 3,2,4?
b. an array of rank 4?
Do you own homework - it's not hard!
-- Barry
-- http://barrkel.blogspot.com/
AA2e72E <AA*****@discus sions.microsoft .comwrote:
Learn to read before jumping to prescribe.
My note says that I know the rank (number of dimensions) is 3; I go on to
tell you that the dimensions are 3,1,4. The question was how would I modify
the right hand side (RHS) such that the rank stayed as 3 but he dimensions
were 3,2,4 i.e how would I increase the second dimension to 1.
The second question was whether the RHS was a 'literal ' notation.
If you did not know, or cannot be bothered to understand what is written,
why do't you simply choose not to respond? Your answer adds nothing.
Barry gave a very good answer, which led you through how to understand
the different dimensions.
I suggest you reread his answer, and work through it slowly - by the
end, you'll be able to understand how to answer the questions yourself.
What I would suggest is that you put each bracing level on a new line,
rather than the whole thing in one line. That might make it clearer.
--
Jon Skeet - <sk***@pobox.co m> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Well, that's a pretty good way of ensuring that no-one will help you with
your homework. Congratulations . I hope the foot gets better soon.
Just for your info, in case you should ever post to a newsgroup again
seeking help with homework, you should ensure that you do the following:
* State clearly that you are looking for help with homework
* Explain what research you have carried out, what you have already tried
and what the results were.
* Assure the group that answers will be credited to the group or individual
giving the advice and that you will not try to pass off other people's work
as your own.
That's what I did when studying for my MSc recently. I got lots of help and
I was as good as my word in terms of crediting other people when they had
helped me out. I even posted my answers so that people could check it out
for themselves. This also got me a commendation from my tutor.
Oh! and finally. Remember that students can be dismissed for plagiarism,
and that professors also read newsgroups.
Peter
"AA2e72E" <AA*****@discus sions.microsoft .comwrote in message
news:83******** *************** ***********@mic rosoft.com...
Learn to read before jumping to prescribe.
My note says that I know the rank (number of dimensions) is 3; I go on to
tell you that the dimensions are 3,1,4. The question was how would I
modify
the right hand side (RHS) such that the rank stayed as 3 but he dimensions
were 3,2,4 i.e how would I increase the second dimension to 1.
The second question was whether the RHS was a 'literal ' notation.
If you did not know, or cannot be bothered to understand what is written,
why do't you simply choose not to respond? Your answer adds nothing.
PS: I had bothered to research my own answers but came with nothing; hence
the post.
"Barry Kelly" wrote:
>AA2e72E wrote:
int[, ,] array = { { { 1, 2, 3, 3 }}, { { 7, -1, 9, 0 } }, { { -1, 0,
7, 8 }
} }; // 3D
In the line of code above, am I using 'literal' syntax/notation to
create
the array?
The rank of the array is 3, its dimensions are 3,1,4.
Hint: count '3' '1' '4'. It's equal to 3.
Another hint: * What is there 4 of in the top example? * Given that you've gotten what there's 4 of, what is there only one of, for its given level of nesting? * Can you spot what there's 3 of now?
How would I change the code to produce
a. an array of dimension 3,2,4?
b. an array of rank 4?
Do you own homework - it's not hard!
-- Barry
-- http://barrkel.blogspot.com/
int[, ,] array = { { { 1, 2, 3, 3 }}, { { 7, -1, 9, 0 } }, { { -1, 0, 7,
8 }
} }; // 3D
In the line of code above, am I using 'literal' syntax/notation to create
the array?
The rank of the array is 3, its dimensions are 3,1,4.
Since you already know what dimension and rank the first array declaration
is, it would be elementary for you to produce another according to the
specifications you've given, unless a teacher had given you this as a
problem, and you were simply trying to get someone to solve it for you. But
if that were the case, I would not be doing you any favor to solve it for
you, since programming is all problem-solving, and to solve your problem for
you would not give you any experience in problem-solving.
However, I will give you a link to a C# ECMA specification that you should
be able to use to figure it out for yourself: http://www.jaggersoft.com/csharp_standard/toc.htm
--
HTH,
Kevin Spencer
Microsoft MVP
Software Composer http://unclechutney.blogspot.com
I had the same problem once. Fixed it using the same solution.
"AA2e72E" <AA*****@discus sions.microsoft .comwrote in message
news:25******** *************** ***********@mic rosoft.com...
int[, ,] array = { { { 1, 2, 3, 3 }}, { { 7, -1, 9, 0 } }, { { -1, 0, 7,
8 }
} }; // 3D
In the line of code above, am I using 'literal' syntax/notation to create
the array?
The rank of the array is 3, its dimensions are 3,1,4.
How would I change the code to produce
a. an array of dimension 3,2,4?
b. an array of rank 4?
Thanks.
Peter, thanks for another <almostuseles s answer; however, I now understand
the implication of 'homework' : I originally understood it to me 'do your own
research'
Let me assure you, this has nothing to do with homework; I am in my 50's
moving on from VB into C#. So far so good, but I do get stuck sometimes, as
in this situation.
I looked for the answers in "C# Language Reference" and did not find it;
search with Google and was not successful there either.
If you create a new project and put a button on it, and have this code in
its click event:
int[, ,] array = { { { 1, 2, 3, 3 }}, { { 7, -1, 9, 0 } }, { { -1,
0, 7, 8 } } }; // 3D
string xx="";
for (int i=0;i<array.Ran k;i++)
{
xx += " " + (array.GetUpper Bound(i)+1).ToS tring();
}
MessageBox.Show (xx);
You will have an insight and how I got the dimensions. I know that I need to
specify the elements of the next second dimension within the braces of the
RHS; tied several things and no success!
So, could someone just answer the questions, please?
Kevin, thanks; I try and find the answer using your link. I am sure it will
be there.
As you will see from a previous reply, I am not trying to get someone else
to solve it for me (I am not a student); in fact, for the context that I am
working on, I simply needed to establish that the array was square but got
side-tracked ( .. for something I need to do later).
I agree, that the best way to learn is to solve the problems oneself;
however, after a while, there is a tradeoff between simply asking and
persevering ...
"AA2e72E" <AA*****@discus sions.microsoft .comwrote in message
news:25******** *************** ***********@mic rosoft.com...
int[, ,] array = { { { 1, 2, 3, 3 }}, { { 7, -1, 9, 0 } }, { { -1, 0, 7,
8 }
} }; // 3D
In the line of code above, am I using 'literal' syntax/notation to create
the array?
The rank of the array is 3, its dimensions are 3,1,4.
How would I change the code to produce
a. an array of dimension 3,2,4?
b. an array of rank 4?
Thanks.
When dealing with multi-dimensional arrays, it may be helpful to re-organize
the code of the array literals to help identify the different "layers" of
the array, such as:
int[, ,] array =
{
{
{ 1, 2, 3, 3 }
},
{
{ 7, -1, 9, 0 }
},
{
{ -1, 0, 7, 8 }
}
}; // 3D
Does this help you identify what your looking for? I didn't give it away,
but am trying to help you see what you need and come to the conclusion(s)
yourself. Try playing with it a bit...
HTH,
Mythran This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Terence |
last post by:
I usually program in Java, so I am a bit confused about usint pointers in C.
I would really appreciate if someone can help me.
Case 1:
======
// Is this function no good? Since str is a variable created on stack,
// I am assuming it will be deallocated immedately after the function returns,
// right??
char * generateString()
|
by: aliensite |
last post by:
<html>
<body>
<script>
// object constructor
function names(fname,lname){
this.fname=fname;
this.lname=lname
}
// object arrays
list = new Array()
|
by: Duderonomoy |
last post by:
Hello,
I am querying the JavaScript community to learn if
others are having problems with Safari and JavaScript
arrays:
myImages = ;
then referenced like this:
|
by: Christopher Benson-Manica |
last post by:
If an array is sparse, say something like
var foo=;
foo=4;
foo='baz';
foo='moo';
is there a way to iterate through the entire array?
--
|
by: meltedown |
last post by:
Theres something very basic about javascript arrays I'm missing.
The value of unit.value is 17.00
and value of the qty.value is 5
and I put these values into an array: myarray.value]=qty.value;
I accessed the qty.value by putting it into <div id='test2>:
document.getElementById('test2').innerHTML+=myarray.value];
and it says 5
so far so good.
| |
by: Luke |
last post by:
Here is my emails to Danny Goodman (but probably he is very busy so he
didn't answered it).
First email(simple): Subject: JavaScript Arrays
"
We all know the array can act like HashMap, but is there a shortcut
for creating such array ? eg
//simple array indexed via numbers
var a = new Array("a", "fdsf", "sada");
or,
|
by: Paul Morrison |
last post by:
Hi all,
I need to come up with some differences between arrays in Java and C, I have
searched Google and so far all I have found is the following:
Arrays in Java are reference types with automatic allocation of memory. In
C, arrays are groups of variables of the same type in adjacent memory.
Allocation for dynamic arrays is handled by the programmer.
This is an 8 mark question in an old exam paper, so I am assuming there are
|
by: mechanicfem |
last post by:
I thought (as they're in c99) that flexible arrays were there for a
number of reasons - but I also thought they'd be great for stepping
into structures (say) that were aligned in memory after (say) a header
struct, e.g.:
struct element
{
int a;
int b;
};
|
by: mdh |
last post by:
>From the list of questions...arrays certianly seem to be the biggest
source of puzzlement. I can understand why.
I reluctantly ask this...knowing it does not work, but the issue is
why? ( It is related to exercise 5-13, K&R). I have looked at the FAQ,
but still no luck.
#include <stdio.h>
#include <string.h>
int main (int argc, const char * argv) {
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |