473,569 Members | 3,040 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Answer to question 4.8 from the FAQ

Hello,

In the answer to question 4.8 I see this code (copied and pasted):

-------------------------
void f(ipp)
int **ipp;
{
static int dummy = 5;
*ipp = &dummy;
}
....

int *ip;
f(&ip);
-------------------------

I'm confused about the two first lines. Should'nt the first one be
written 'void f(**ipp)' and the second one scrapped altogether?

If not, I don't understand how the above can be legal.

JFL
--
Jean-François Lemaire
Jan 4 '08 #1
4 1254
Jean-François Lemaire wrote:
Hello,

In the answer to question 4.8 I see this code (copied and pasted):

-------------------------
void f(ipp)
int **ipp;
{
static int dummy = 5;
*ipp = &dummy;
}
...

int *ip;
f(&ip);
-------------------------

I'm confused about the two first lines. Should'nt the first one be
written 'void f(**ipp)' and the second one scrapped altogether?
ITYM `void f(int **ipp)'.
If not, I don't understand how the above can be legal.
Question 11.3 has a useful hint, and 11.4 is worth
a look, too.

--
Er*********@sun .com

Jan 4 '08 #2
On Friday 4 January 2008 17:28, Eric Sosman wrote:
Jean-François Lemaire wrote:
>In the answer to question 4.8 I see this code (copied and pasted):

-------------------------
void f(ipp)
int **ipp;
{
static int dummy = 5;
*ipp = &dummy;
}
...

int *ip;
f(&ip);
-------------------------

I'm confused about the two first lines. Should'nt the first one be
written 'void f(**ipp)' and the second one scrapped altogether?

ITYM `void f(int **ipp)'.
IID (Indeed I Did).
>If not, I don't understand how the above can be legal.

Question 11.3 has a useful hint, and 11.4 is worth
a look, too.
OK, I understand now. I'm not used to reading the old style syntax and
would have never thought it was simply that.

Thanks for pointing me in the right direction.

JFL
--
Jean-François Lemaire
Jan 4 '08 #3
Jean-Francois Lemaire <jf*******@skyn et.bewrites:
In the answer to question 4.8 I see this code (copied and pasted):

-------------------------
void f(ipp)
int **ipp;
{
static int dummy = 5;
*ipp = &dummy;
}
[...]

That's an old-style function definition; it predates the ANSI
standard, but it's still permitted, even in C99.

What I don't know is why the FAQ still uses it here. I see no good
reason not to use a prototype. Probably it's just an oversight. I've
sent e-mail to Steve Summit.

(Sorry about mangling your name; this environment isn't handling
non-ASCII characters very well.)

--
Keith Thompson (The_Other_Keit h) <ks***@mib.or g>
[...]
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Jan 4 '08 #4
On Friday 4 January 2008 21:26, Keith Thompson wrote:
Jean-Francois Lemaire <jf*******@skyn et.bewrites:
>In the answer to question 4.8 I see this code (copied and pasted):

-------------------------
void f(ipp)
int **ipp;
{
static int dummy = 5;
*ipp = &dummy;
}
[...]

That's an old-style function definition; it predates the ANSI
standard, but it's still permitted, even in C99.

What I don't know is why the FAQ still uses it here. I see no good
reason not to use a prototype. Probably it's just an oversight. I've
sent e-mail to Steve Summit.
Yes, this can be confusing for new users of the language, the intended
audience of the FAQ, who are less likely to have encountered such a
function definition. At least it was confusing for me.
(Sorry about mangling your name; this environment isn't handling
non-ASCII characters very well.)
No excuse needed, I can assure you.

JFL
--
Jean-François Lemaire
Jan 4 '08 #5

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

Similar topics

3
5185
by: Mohammed Mazid | last post by:
Hi folks! Can anyone please help me with this? I am developing a Quiz program but I am stuck with "multiple answers". Basically I need some sort of code that would select multiple answers using check boxes. For example, a question such as
4
3593
by: Mohammed Mazid | last post by:
Hi folks! Can anyone please help me with this? I am developing a Quiz program but I am stuck with "multiple answers". Basically I need some sort of code that would select multiple answers using check boxes. For example, a question such as
9
3739
by: Dave H | last post by:
Hello, I have a query regarding definition lists. Is it good practice semantically to use the dt and dd elements to mark up questions and answers in a frequently asked questions list, or FAQ? Here is an example of just such a usage: <dl class="faq"> <di>
4
3029
by: Nigel Molesworth | last post by:
I've Googled, but can't find what I need, perhaps I asking the wrong question! I want a "FAQ" page on a web site, I hate those pages that scroll you to the answer so and I figured that a good way to do it would be to have hidden content under each question, something like this : What is the first letter of the alphabet?
2
1967
by: amelia170 | last post by:
I am creating a database with a yes or no answer for question 1. Based on that answer, (if they answer yes) they will answer question 2, then three....However, if they answer no to question one, I want them not to be able to answer question 2 at all. Ideas? Thanks so much!
32
9419
by: Michael C | last post by:
I want to inherit from Bitmap to add a property but I can't because it's sealed. Is there any reason to seal a class? Thanks, Michael
0
834
by: Ryan | last post by:
Although I would like my application to require Question and Answer, I plan to allow a central administrator to create accounts and then require users to setup their Question/Answer the first time they login. Therefore, I was wondering: Is it possible to set the New User wizard control to permit a blank Question/Answer WITHOUT turning off...
2
6842
by: Jonathan Wood | last post by:
In my application, new accounts must be created by an administrator--users will not create their own. Ideally, the user could then log on and specify their own password question and answer, and the administrator doesn't even know what that question and answer is. I thought I could do this since Membership.CreateUser() includes an overload...
2
7652
by: Ken Fine | last post by:
I want to add the security question and answer security feature to the ChangePassword control. I am aware that this functionality is built into the PasswordRecovery tool. I have implemented the PasswordRecovery with a Password reset required; a temporary password is sent to the account on file. I want an extra layer of security to accommodate...
0
7703
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...
0
7619
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...
1
7681
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...
0
7983
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...
0
6290
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5514
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...
0
3662
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...
1
2118
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1229
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.