473,480 Members | 1,980 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

What do "int *p(char *a)" & "char (*p)(int *a)" mean?

I cant recognise them as declarations of some arrays or so... Are they some declaration of functions with parameter & return type? If so, then how come function names are missing?
Nov 7 '10 #1
1 14008
weaknessforcats
9,208 Recognized Expert Moderator Expert
"int *p(char *a)" & "char (*p)(int *a)" mean?

This code is written to trip you up since beginners think "p" means "pointer". Because of that assumption, you can't read this code.

Expand|Select|Wrap|Line Numbers
  1. int *p(char *a) 
is a function named "p" that takes a char* argument "a" and returns a pointer to an int. You would have no problem were it written like this:

Expand|Select|Wrap|Line Numbers
  1. int *MyFunction(char *arg)
This one:

Expand|Select|Wrap|Line Numbers
  1. char (*p)(int *a)
defines "p" to be a pointer to a function that takes an int* arguments "a" and returns a char.

I expect I am doing your homework, but at least now you know.
Nov 7 '10 #2

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

Similar topics

8
2233
by: pembed2003 | last post by:
Hi coders, I have the following: void f1(char* &s){ *s = 'a'; } void f2(char* s){ *s = 'b'; }
14
2703
by: Peter Mount | last post by:
Hello I'm having trouble with " scanf("%c", &answer);" on line 20 below. When I run the program in cygwin on Windows 98SE it skips that line completely and ends the program. Does scanf have...
5
3931
by: jab3 | last post by:
(again :)) Hello everyone. I'll ask this even at risk of being accused of not researching adequately. My question (before longer reasoning) is: How does declaring (or defining, whatever) a...
1
7271
by: sharmadeep1980 | last post by:
Hi All, I am facing a very unique problem while compling my project in "Release" build. The project is building in DEBUG mode but giving linking error on Release build. Here is the error:...
5
14083
by: Omats.Z | last post by:
what is meaning os "char **option meet"? I get a function like this: __________________________________ int getchoice(char *greet, char *choices) { int chosen = 0; int selected; char **option;...
21
2369
by: Steven T. Hatton | last post by:
I'm trying to improve my formal understanding of C++. One significant part of that effort involves clarifying my understanding of the vocabulary used to describe the language. This is from the...
33
2227
by: onkar | last post by:
#include<stdio.h> int main(int argc,char **argv){ int a={1,2,3,4,5}; printf("%p\n%p\n",a,&a); return 0; } gives me : 0xbfe837a0
4
6272
by: arnuld | last post by:
i am learning C and doing the exercise 1-1 of K&R2, where K&R ask to remove some parts of programme and experiment with error, so here i go: #include <stdio.h> int main () { printf('hello...
5
3410
by: arnuld | last post by:
it compiles without any trouble but produces "Segmentation Fault" when i try to run it. since i am at chapter 2 so my knowledge of arrays is limited to chapter 1: -------------------------...
2
3424
by: ragged_hippy | last post by:
Hi, If I have a method that has string reference as a parameter, what happens if I pass a const char* variable to this method? One thought is that a temporary string will be created in the...
0
6918
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...
0
7057
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
7102
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...
1
6756
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...
0
5357
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
4495
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...
0
3008
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...
0
3000
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
570
muto222
php
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.