473,320 Members | 2,122 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

arrays-2d

1
I wanna ask answer to this question

a 2d array is declared asA[9,7] AND each element requires 2 bytes. If A[1,1] is stored in 3000 find the memory of A[8,5].

please answer this question as soon as possible.....
Sep 17 '06 #1
5 2129
I wanna ask answer to this question

a 2d array is declared asA[9,7] AND each element requires 2 bytes. If A[1,1] is stored in 3000 find the memory of A[8,5].

please answer this question as soon as possible.....



int occupies two bytes in c so here in ur query if a[1][1] is stored in then a[1][2] occupies 3002 a[1][2] is stored in 3004 like this u can go on calculating n u will get the answer
Sep 17 '06 #2
Banfa
9,065 Expert Mod 8TB
int occupies two bytes in c
This is factually incorrect, on some platforms an int is 2 bytes many platforms today int is 4 bytes.

On many platforms today short is 2 bytes but c does not guarantee that all c guarantees about variable size is that

sizeof(char) == 1

sizeof(char) <= sizeof(short) <= sizeof(int) <= sizeof(long)
Sep 17 '06 #3
This is factually incorrect, on some platforms an int is 2 bytes many platforms today int is 4 bytes.

On many platforms today short is 2 bytes but c does not guarantee that all c guarantees about variable size is that

sizeof(char) == 1

sizeof(char) <= sizeof(short) <= sizeof(int) <= sizeof(long)

It only depends on machine's nature either it is 16bit, 32 bit or 64bit etc. ok.
Sep 21 '06 #4
I wanna ask answer to this question

a 2d array is declared asA[9,7] AND each element requires 2 bytes. If A[1,1] is stored in 3000 find the memory of A[8,5].

please answer this question as soon as possible.....

It only depends on machine's nature either it is 16bit, 32 bit or 64bit etc. ok.
Sep 21 '06 #5
Banfa
9,065 Expert Mod 8TB
It only depends on machine's nature either it is 16bit, 32 bit or 64bit etc. ok.
It does depend on the machines nature but it is not limited to those values you give.

As far as the C standard is concerned an int can be on any byte size from 1 - infinity and the number of bits in a byte can be any number from 1 - infinity.
Sep 21 '06 #6

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

Similar topics

19
by: Canonical Latin | last post by:
"Leor Zolman" <leor@bdsoft.com> wrote > "Canonical Latin" <javaplus@hotmail.com> wrote: > > > ... > >But I'm still curious as to the rational of having type >...
21
by: Matteo Settenvini | last post by:
Ok, I'm quite a newbie, so this question may appear silly. I'm using g++ 3.3.x. I had been taught that an array isn't a lot different from a pointer (in fact you can use the pointer arithmetics to...
5
by: JezB | last post by:
What's the easiest way to concatenate arrays ? For example, I want a list of files that match one of 3 search patterns, so I need something like DirectoryInfo ld = new DirectoryInfo(searchDir);...
3
by: Michel Rouzic | last post by:
It's the first time I try using structs, and I'm getting confused with it and can't make it work properly I firstly define the structure by this : typedef struct { char *l1; int *l2; int Nval; }...
1
by: Rob Griffiths | last post by:
Can anyone explain to me the difference between an element type and a component type? In the java literature, arrays are said to have component types, whereas collections from the Collections...
41
by: Rene Nyffenegger | last post by:
Hello everyone. I am not fluent in JavaScript, so I might overlook the obvious. But in all other programming languages that I know and that have associative arrays, or hashes, the elements in...
6
by: Robert Bravery | last post by:
Hi all, Can some one show me how to achieve a cross product of arrays. So that if I had two arrays (could be any number) with three elements in each (once again could be any number) I would get:...
1
by: Doug_J_W | last post by:
I have a Visual Basic (2005) project that contains around twenty embedded text files as resources. The text files contain two columns of real numbers that are separated by tab deliminator, and are...
16
by: mike3 | last post by:
(I'm xposting this to both comp.lang.c++ and comp.os.ms- windows.programmer.win32 since there's Windows material in here as well as questions related to standard C++. Not sure how that'd go over...
29
weaknessforcats
by: weaknessforcats | last post by:
Arrays Revealed Introduction Arrays are the built-in containers of C and C++. This article assumes the reader has some experiece with arrays and array syntax but is not clear on a )exactly how...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.