Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read SiteMap

Tags: , , , ,

Sponsored Links



Pointer parameter in a function

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 14-12-2009
Member
 
Join Date: Apr 2009
Posts: 79
Pointer parameter in a function

I know function Pointers allow to callback functions but i want to the know the syntax and the procedure to declare function and to pass char pointer into function. Any recommendations and suggestions are appreciated.
Reply With Quote
  #2  
Old 14-12-2009
Zecho's Avatar
Member
 
Join Date: May 2008
Posts: 2,267
Re: Pointer parameter in a function

Function Pointers are pointers, i.e. variables, which point to the address of a function. Function pointers are often used within subroutines in cases where one would want the subroutine to be able to work with classes of functions whose names one might not know until the program is running. When dereferenced, a function pointer invokes a function, passing it zero or more arguments just like a normal function. You must keep in mind, that a running program gets a certain space in the main-memory.
Reply With Quote
  #3  
Old 14-12-2009
Member
 
Join Date: Jan 2009
Posts: 199
Re: Pointer parameter in a function

Initializing, De-referencing a Pointer Variable :

Examples:
Code:
int u;
int k;
int* pic1;
int* pic2;
char* pcr;

pic1 = NULL;
pcr = NULL;
pic2 = &i;    
pic1 = pic2;
pcr = (char*)&k;   
*pic2 = 6;    
pic2 = &j;
*pic2 = 18;
Reply With Quote
  #4  
Old 14-12-2009
Member
 
Join Date: Dec 2008
Posts: 177
Re: Pointer parameter in a function

Try this example :
Code:
#include <stdio.h>

void print_vertical(char *strl);  
int main(int arc, char *argv[])
{
  if(arc > 1) print_vertical(argv[2]);

  return 0;
}

void print_vertical(char *strl)
{
  while(*strl)
    printf("%c\n", *strl++);
}
Reply With Quote
  #5  
Old 14-12-2009
Member
 
Join Date: Dec 2009
Posts: 1
Re: Pointer parameter in a function

Thanks you:I have exactly the same problem as you. I tested in my IDE, everything works and displayed my JOptionPane.The call is contained in my classes in other Jar. But when I launch the application nothing happens except the normal opening.

This is quite problematic for me, since the external jar used to validate the registration of the software license and as it does not appeal to class everything goes well without the software is not registered. And again I have only this problem with MAC. When I run under Windows or Linux or directly from my main .jar it works!


__________________
Simulation rachat credit personnel reduit | Demande rachat credit personnel en ligne | Comparatif meilleur taux rachat credit pret personnel
Reply With Quote
Reply

  TechArena Community > Software > Software Development


Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Pointer parameter in a function"
Thread Thread Starter Forum Replies Last Post
Parameter function and generic pointer Rubero Software Development 7 25-09-2010 10:04 PM
Matrix parameter function Chrisch Software Development 3 02-12-2009 11:07 AM
Pointer of file in parameter Wyvern Software Development 4 05-11-2009 11:50 PM
Problem in a function pointer Rilex Software Development 3 23-05-2009 11:21 PM
Exercise pointer and function in C Bull50 Software Development 3 10-04-2009 12:51 AM


All times are GMT +5.5. The time now is 11:07 AM.