LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-12-2013, 07:47 AM   #1
atlantis43
Member
 
Registered: Feb 2013
Posts: 289

Rep: Reputation: Disabled
function pointer argument


Wondering if anyone can explain, in simple terms, what the argument "(char const *,...)" means in a C99 command such as:
Code:
int (*funcPtr)(char const *,...);
------especially, the *,... portion of the argument.
 
Old 06-12-2013, 08:01 AM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
"char const" and "const char" mean the same thing in this case given the parenthesis.

The const modifier would normally apply to the variable type on it's left.

Many people write the const first as in
Code:
const char myArray[64];
and when they do so on a variable declaration line, either at the start of the line or just after a comma delimiter because there was another term, the const ends up affecting the variable type to the right of it instead.

Short answer is it means pointer to a constant character, same as
Code:
const char *
would mean the same thing.
 
1 members found this post helpful.
Old 06-12-2013, 08:25 AM   #3
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
The ... means it's a variadic function, i.e. it takes an arbitrary number of arguments. It looks like a function pointer to a printf type of function.

Kevin Barry
 
1 members found this post helpful.
Old 06-12-2013, 08:38 AM   #4
atlantis43
Member
 
Registered: Feb 2013
Posts: 289

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by ta0kira View Post
The ... means it's a variadic function, i.e. it takes an arbitrary number of arguments. It looks like a function pointer to a printf type of function.

Kevin Barry
Yes, it is a pointer to printf(), and both responses combined successfully addressed my question.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] case function for no-argument - default function for script? Batistuta_g_2000 Linux - Newbie 3 03-13-2013 10:00 AM
( C ) How do you declare a function pointer where a parameter is a function pointer? spursrule Programming 5 11-27-2007 07:56 PM
format argument is not a pointer lloydie-t Programming 2 09-11-2006 01:47 PM
Function Pointer as an Argument in C trutnev Programming 5 05-24-2005 10:22 AM
passing function pointer as argument worldmagic Programming 7 08-04-2004 03:33 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:16 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration