void function(type **, type *) // more info. PLEASE HELP

This is a discussion on void function(type **, type *) // more info. PLEASE HELP within the C Programming forums, part of the General Programming Boards category; My problem is when I call function putfirst. prototype of putfirst: void putfirst(nodo**, nodo*); At the end of the code ...

  1. #1
    Registered User Seek n Destroy's Avatar
    Join Date
    Sep 2002
    Posts
    9

    Angry void function(type **, type *) // more info. PLEASE HELP

    My problem is when I call function putfirst.
    prototype of putfirst: void putfirst(nodo**, nodo*);
    At the end of the code is function putfirst
    Code:
    global declaration of type
    
    typedef struct nodo {
    			  int codigo;
    			  char pro[30];
    			  float pre;
    			  struct nodo *siguiente;
    			  }nodo;
    
    local pointers
    nodo *h=NULL, *x;
    x=(nodo *)malloc(sizeof(nodo));
    
    produ=fopen("c:/producto.dat", "rt");
    
    scanf("%d",&producto);
    while(producto!=255)
    	{
    	rewind(produ);
    	x=(nodo *)malloc(sizeof(nodo));
    	while(!feof(produ))
    		{
    		fread(&x->codigo,2,1,produ);
    		fread(x->pro,30,1,produ);
    		fread(&x->pre,sizeof(float),1,produ);
    		if(x->codigo==producto)
    			{
    			printf("\nproducto encontrado");
    			break;
    			}
    		if(feof(produ))
    			{
    			printf("\nNo se encontro el producto, ingreselo manualmente");
    			printf("\nDescripcion: ");
    			scanf("%s",x->pro);
    			printf("\nPrecio: ");
    			scanf("%f",x->pre);
    			}
    		putfirst(&h,x);
    		scanf("%d",&producto);
    	   }
    
    
    void putfirst(nodo **ph, nodo *p)
    {
    p->siguiente=*ph;
    *ph=p;
    return;
    }
    code tag's added by your friendly mod

  2. #2
    Unleashed
    Join Date
    Sep 2001
    Posts
    1,765
    The world is waiting. I must leave you now.

  3. #3
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    Originally posted by Shadow
    code tags
    To add to that.....perhaps if you explained what the problem actually was it would make working out the answer that much easier

  4. #4
    Lead Moderator kermi3's Avatar
    Join Date
    Aug 1998
    Posts
    2,595
    code tags added.
    Kermi3

    If you're new to the boards, welcome and reading this will help you get started.
    Information on code tags may be found here

    - Sandlot is the highest form of sport.

  5. #5
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    There's some link list help here if that's of any use.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  6. #6
    Registered User Seek n Destroy's Avatar
    Join Date
    Sep 2002
    Posts
    9
    I ve solved the problem, it was that structure nodo was repeated gobal and local, and the compiler went crazy with that,
    Thanks to all wo had helped.
    Seek n Destroy

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. seg fault at vectornew
    By tytelizgal in forum C Programming
    Replies: 2
    Last Post: 10-25-2008, 02:22 PM
  2. Pls repair my basketball program
    By death_messiah12 in forum C++ Programming
    Replies: 10
    Last Post: 12-11-2006, 05:15 AM
  3. Using VC Toolkit 2003
    By Noobwaker in forum Windows Programming
    Replies: 8
    Last Post: 03-13-2006, 07:33 AM
  4. Please Help - Problem with Compilers
    By toonlover in forum C++ Programming
    Replies: 5
    Last Post: 07-23-2005, 11:03 AM
  5. Learning OpenGL
    By HQSneaker in forum C++ Programming
    Replies: 7
    Last Post: 08-06-2004, 09:57 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21