473,836 Members | 1,510 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C Pointer problem

Hi,

I can't understand why this code causes a "memory read exception" at
int x=**a;

void pass(int** a)
{
int x=**a;
}
void main()
{
int arr[2][2]={{1,2},{3,4}};
pass(arr);
}
The assignment of int int x=**a in the main function works.

Tanks for your help,
Markus

May 31 '06
73 3877
>> Someone tell me, does one learn PODMAS instead of BODMAS in the USA?


I actually learned BOMDAS at school, rather than "BODMAS".

Brackets
Off
Multiply
Divide
Add
Substract


Parentheses count. I always thought that math as well as FORTRAN
and C taught BO(MD)(AS), *not* BODMAS nor BOMDAS, unless division
was represented textually as a big horizontal bar with the denominator
being clearly distinguished by what was under the bar. But I was
educated on the USA side of the pond.

Gordon L. Burditt

--
This newsgroup is comp.lang.c . Please post articles consisting
entirely of discussion about attributions, top-posting, Google,
topicality, Web TV, bottom-posting, forgeries, netiquette, trolls,
and cross-posting to cop.lang.c, not comp.lang.c .
Jun 28 '06 #51
Mark McIntyre wrote:
On Mon, 26 Jun 2006 02:30:03 GMT, in comp.lang.c , pete
<pf*****@mindsp ring.com> wrote:

The example shown had empty parentheses and empty braces
and he was saying something that you suggest was false
about empty brackets.


It was, obviously, contained within the brackets. -)
So where's my clue as to what he's talking about?


Two nations divided by a common language indeed.

For the record, brackets come in three flavours, square, wiggly and
plain.


4. angle <>

goose

Jun 28 '06 #52
goose wrote:

Mark McIntyre wrote:
On Mon, 26 Jun 2006 02:30:03 GMT, in comp.lang.c , pete
<pf*****@mindsp ring.com> wrote:

The example shown had empty parentheses and empty braces
and he was saying something that you suggest was false
about empty brackets.


It was, obviously, contained within the brackets. -)
So where's my clue as to what he's talking about?


Two nations divided by a common language indeed.

For the record, brackets come in three flavours, square, wiggly and
plain.


4. angle <>


The standard doesn't give a name for <>,
but I also call them angle brackets.

I will always advocate using standard terminology,
when discussing what the C standard says.

--
pete
Jun 28 '06 #53
In article <11************ *********@75g20 00cwc.googlegro ups.com>,
goose <ru**@webmail.c o.za> wrote:
Mark McIntyre wrote:
For the record, brackets come in three flavours, square, wiggly and
plain.

4. angle <>


I understand that in at least some parts of Europe (e.g., France), there
is also <<>> where << and >> are the closest easy representation
to single characters smaller and raised to be centred on the line.
I have, though, not encountered this enough to be sure whether they
are used as brackets or only as a form of quotation -- I -think- I've
seen both uses.
--
"law -- it's a commodity"
-- Andrew Ryan (The Globe and Mail, 2005/11/26)
Jun 28 '06 #54
Walter Roberson wrote:

I understand that in at least some parts of Europe (e.g., France),
there is also <<>> where << and >> are the closest easy representation
to single characters smaller and raised to be centred on the line.


http://en.wikipedia.org/wiki/Guillemet


Brian
Jun 28 '06 #55
Mark McIntyre <ma**********@s pamcop.net> writes:
[...]
Two nations divided by a common language indeed.

For the record, brackets come in three flavours, square, wiggly and
plain.

gd&r


Does British English not commonly use the terms "parenthese s" and
"braces"?

I understand that "braces" refers to the clothing accessory that
Americans refer to as "suspenders ", but there seems to be little
chance of confusion.

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Jun 28 '06 #56
Keith Thompson wrote:
Mark McIntyre <ma**********@s pamcop.net> writes:
[...]
Two nations divided by a common language indeed.

For the record, brackets come in three flavours, square, wiggly and
plain.

gd&r

Does British English not commonly use the terms "parenthese s" and
"braces"?

Not in normal speech, "brackets" and "curly brackets" would be more common.
I understand that "braces" refers to the clothing accessory that
Americans refer to as "suspenders ", but there seems to be little
chance of confusion.

"suspenders " hold up women's stockings, so talk of a man in suspenders
can cause all sorts of confusion!

The joys of a common language..

--
Ian Collins.
Jun 28 '06 #57
Keith Thompson wrote:
Mark McIntyre <ma**********@s pamcop.net> writes:
[...]
Two nations divided by a common language indeed.

For the record, brackets come in three flavours, square, wiggly and
plain.

gd&r
Does British English not commonly use the terms "parenthese s" and
"braces"?


Parentheses was used in my maths class as school in Britain oh so many
years ago and we were told that it, and not brackets, was the correct
term for (). However, it was certainly common back then for people to
describe () as brackets.

So I, born and brought up in England, am happy with the terms
parenthesis (), brackets [] and braces {} but can also accept and cope
with round brackets, square brackets and squiggly brackets. I'll also
accept brackets for () without comment if the context removes any ambiguity.
I understand that "braces" refers to the clothing accessory that
Americans refer to as "suspenders ", but there seems to be little
chance of confusion.


Yes, this is also true. Assuming, of course, that Americans common call
braces suspenders. However, you should possibly be aware that in Britain
suspenders are used by ladies to hold their stockings up, so be careful
what you ask for in a clothing store in Britain ;-)
--
Flash Gordon, living in interesting times.
Web site - http://home.flash-gordon.me.uk/
comp.lang.c posting guidelines and intro:
http://clc-wiki.net/wiki/Intro_to_clc
Jun 28 '06 #58
Tom St Denis wrote:
Frederick Gotham wrote:
Should I wait for you to re-post acknowledging your mistake, or should I
post the solution now?
If we multiply first, we get:

4*12 divided by 3*8
But that isn't what you wrote. You wrote 4*12/3*8.
which becomes:

48 divided by 24


No that becomes 4*4*8.


Which part of "if we multiply first" escaped you?
Not only does logic dictate that


Logic doesn't have a say in it. Operator precedence is about convenient
convention.

--
Chris "logic is a good servant but a bad master" Dollin
"Life is full of mysteries. Consider this one of them." Sinclair, /Babylon 5/

Jun 29 '06 #59
Ian Collins <ia******@hotma il.com> wrote:
Keith Thompson wrote:
Mark McIntyre <ma**********@s pamcop.net> writes:
Two nations divided by a common language indeed.

For the record, brackets come in three flavours, square, wiggly and
plain.


Does British English not commonly use the terms "parenthese s" and
"braces"?

Not in normal speech, "brackets" and "curly brackets" would be more common.


Probably because strictly speaking the parenthesis is the phrase
inserted into the surrounding sentence, nor either of the marks
delimiting it.
I understand that "braces" refers to the clothing accessory that
Americans refer to as "suspenders ", but there seems to be little
chance of confusion.

"suspenders " hold up women's stockings, so talk of a man in suspenders
can cause all sorts of confusion!


Unless, of course, said man wants to be a lumberjack.

Richard
Jun 29 '06 #60

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2149
by: Carsten Spieß | last post by:
Hello all, i have a problem with a template constructor I reduced my code to the following (compiled with gcc 2.7.2) to show my problem: // a base class class Base{}; // two derived classes
5
6066
by: John N. | last post by:
Hi All, Here I have a linked list each containing a char and is double linked. Then I have a pointer to an item in that list which is the current insertion point. In this funtion, the user hits the right and left keys to move this insertion point (cursor) Here is the problem:
7
5198
by: Mike D. | last post by:
I have a problem with a dynamic library I am developing, but it is really more of a pointer issue than anything else. Hopefully someone here can lend me some assistance or insight into resolving this. Ok... here goes.... I have a function that passes a pointer to a string to another function. For example: int FunctionA ()
10
4137
by: Kieran Simkin | last post by:
Hi, I wonder if anyone can help me, I've been headscratching for a few hours over this. Basically, I've defined a struct called cache_object: struct cache_object { char hostname; char ipaddr; };
204
13151
by: Alexei A. Frounze | last post by:
Hi all, I have a question regarding the gcc behavior (gcc version 3.3.4). On the following test program it emits a warning: #include <stdio.h> int aInt2 = {0,1,2,4,9,16}; int aInt3 = {0,1,2,4,9};
7
2050
by: Marcelo | last post by:
Hi everybody, I don't understand why I am having a problem in this code. The problem is that my pointer *phist in main method, it is declared. Then I send the pointer to my method, and this method creates a new object (a Matrix) for it. I suppose that after the new operator, my pointer is pointing to an object, so when the method has finished, the very first pointer is still poitint to the created method; however this is not working,...
51
10547
by: Joe Van Dyk | last post by:
When you delete a pointer, you should set it to NULL, right? Joe
2
2850
by: toton | last post by:
Hi, This is continuation of topic pointer & reference doubt. http://groups.google.com/group/comp.lang.c++/browse_thread/thread/df84ce6b9af561f9/76304d7d77f6ccca?lnk=raot#76304d7d77f6ccca But I think it is better to have a new topic rather than continuing on old one. As now I am sure pointer to reference and reference to pointer are freely convertable, the potential danger lies in the first one. Pointer may be NULL, but reference should...
9
3023
by: junky_fellow | last post by:
Hi, To print the pointer using printf(), we convert it to (void *) . printf("%p",(void *)ptr); My question is how printf() determine which type of pointer is passed to it and prints its value accordingly ? I have this doubt as different pointers may have different representation and different size. So, how does printf determine
6
2535
by: worlman385 | last post by:
For pointer and non-pointer initialization of an object like MyCar mycar; MyCar* mycar = new MyCar(); I heard from other people saying if object i create must live outside scape, then I use pointer version, else if only use object for a limited scope, then use non-pointer version. Does limited scope means the object is only used in the same function
0
9814
marktang
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...
0
10838
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10544
jinu1996
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...
0
10250
tracyyun
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...
1
7788
isladogs
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...
0
5645
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...
0
5821
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4010
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3111
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.