Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8682669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T21:50:15+00:00 2026-06-12T21:50:15+00:00

I download a code example written in C, but don’t understand one instruction. And

  • 0

I download a code example written in C, but don’t understand one instruction. And besides, w
hen i try to compile the code the compiler throws me an error just in the line that i don’t understand.

Code:

// Global vars
static int getting_text = 0;
static char *the_text;  // Definition Part
static void (*text_entered)();  // Definition Part 2


// method
int add_text(unsigned char key)
{
  char msg[] = "x";
  int len;

  if(!getting_text) return 0;
  if(key==8) /* backspace */
  {
    len = strlen(the_text);
    the_text[len-1] = '\0';
  }
  else if(key==13 || key==9) // cr or tab ends
  {
    getting_text = 0;
    text_entered(the_text); // Execution Part
  }
  else
  {
    msg[0] = key;
    strcat(the_text, msg);
  }

  glutPostRedisplay();

  return 1;
}

The compiler throws me an error about there are too many arguments in the method’s calling. But i don’t if it’s a method the static void (*xxx)() or if other thing.

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T21:50:16+00:00Added an answer on June 12, 2026 at 9:50 pm

    EDIT: The following only applies to C++. Did you use g++ or some other C++ compiler instead of a C compiler?

    text_entered is a function pointer to a function that doesn’t take any arguments, hence the error, because you’re passing it a character pointer. I assume it should change to,

    static void (*text_entered)(char*);
    

    This is of course assuming text_enterered actually gets set to a function that takes a char* argument and it isn’t just being called wrong.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please download the following code : http://media.pragprog.com/titles/eband3/code/Sudokuv2/src/org/example/sudoku/PuzzleView.java In the code, What initial value does
When I have download sample code from this link and than try to build
I want to download the code for a gem, but the author didn't give
I don't want to download any other libraries, i'm talking about this one: javax.swing.text.html.HTMLEditorKit.Parser
Right now I wrote download code in Masterpage code behind for Menu item click.
I have a file download code in my site which worked perfectly fine untill
I download gcc-code-assist from here , then do make and sudo make install. After
below is the code to download a txt file from internet approx 9000 lines
i have a code which download the apk from server by using Asynctask, Currently
I am prepared code for download images from server and store in sdcard.For that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.