473,398 Members | 2,368 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,398 software developers and data experts.

explain this instruction: void(*pf)(int * const pi);

void(*pf)(int * const pi);
i meet this instruction and i dot understand it
Nov 16 '15 #1
1 1011
weaknessforcats
9,208 Expert Mod 8TB
The parsing always starts with the name and mover to the right until it finds a right parenthesis ) or a semi-colon ;

When either of these is encountered, the parser resumes at the place where it moved right but now it moves left. If a left parenthesis ( or the beginning of the line is encountered, the parser resumes where it left off on the right and moves right.

When the parser reaches the ; the parse is done.

OK. So here we go:

Expand|Select|Wrap|Line Numbers
  1. void(*pf)(int * const pi);
1) Start at the name an move right:
"pf" and we hit a )

2) Position where we started right and move left:
"pf is a pointer" and we hit a (

3) Position where we left off on the right:
"pf is a pointer to a function that takes a const pointer to int" and we hit a )

4) Position where we left off on the left and move left:
"pf is a pointer to a function that takes a const pointer to int and returns void" and we hit a (

5) Position where we left off on the right ad move to the right:
"pf is a pointer to a function that takes a const pointer to int and returns void" and we hit a ;

The parse is done:

"pf is a pointer to a function that takes a const pointer to int and returns void"
Nov 16 '15 #2

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

Similar topics

19
by: Thomas Matthews | last post by:
Hi, Given a structure of pointers: struct Example_Struct { unsigned char * ptr_buffer; unsigned int * ptr_numbers; }; And a function that will accept the structure:
15
by: Dave | last post by:
Hello NG, It is well known that memory-allocating definitions should not be put in a header file. I believe, however, that this does not apply to const definitions. For example: #ifndef...
1
by: electric sheep | last post by:
Hi, can somebody explain the following syntax to me. This is straight from a gnu info file: int main(void) { /* Hashed form of "GNU libc manual". */ const char *const pass =...
2
by: Pinnacle | last post by:
Can anyone explain what is "const char* const*" mean??
16
by: hzmonte | last post by:
Correct me if I am wrong, declaring formal parameters of functions as const, if they should not be/is not changed, has 2 benefits; 1. It tells the program that calls this function that the...
7
by: Bala L | last post by:
I have a class with a private array data member 'm_array'. I have written a public function, called 'fileRead', to read values into the array from a file. I just noticed that I have declared this...
14
by: Tim H | last post by:
I understand the semantics of why this works the way it does. But I wonder if there's a reason for the behaviore at the line marked "QUESTION". I figured if there is an answer, someone here knows...
9
by: t | last post by:
Lippman's C++ Primer says that if you initialize a const static data member in a class, you still need to define the member outside the class but without an initializer. I tried it using Visual...
4
by: newbarker | last post by:
Hello, Very basic question here. If I have the following constants declared in a.cpp and in b.cpp, would there be any possibility of duplicate symbols?: a.cpp -------- #include <string>
12
by: eiji.anonremail | last post by:
Hi all, I'm facing some uncertainty with const template arguments. Maybe someone could explain the general strategy. #include <vector> int main(int arc, char** argv) {
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...
0
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,...
0
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...

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.