Results 1 to 5 of 5

Thread: Pointer parameter in a function

  1. #1
    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.

  2. #2
    Join Date
    May 2008
    Posts
    2,297

    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.

  3. #3
    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;

  4. #4
    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++);
    }

  5. #5
    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

Similar Threads

  1. Parameter function and generic pointer
    By Rubero in forum Software Development
    Replies: 7
    Last Post: 25-09-2010, 09:04 PM
  2. Matrix parameter function
    By Chrisch in forum Software Development
    Replies: 3
    Last Post: 02-12-2009, 11:07 AM
  3. Pointer of file in parameter
    By Wyvern in forum Software Development
    Replies: 4
    Last Post: 05-11-2009, 11:50 PM
  4. Problem in a function pointer
    By Rilex in forum Software Development
    Replies: 3
    Last Post: 23-05-2009, 10:21 PM
  5. Exercise pointer and function in C
    By Bull50 in forum Software Development
    Replies: 3
    Last Post: 09-04-2009, 11:51 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,265,583.85236 seconds with 17 queries