User Profile

Collapse

Profile Sidebar

Collapse
miner
miner
Last Activity: May 8 '10, 01:08 PM
Joined: May 7 '10
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • miner
    replied to Passing a pointer to a function ... how?
    in C
    Thank you for your replies.

    I have to be more specific. Here's is a code sample :

    Code:
    #include <stdio.h>
    #include <malloc.h>
    
    typedef struct node { 
    	int val;
    	struct node *next;
    } NODE;
    
    typedef struct { 
    	NODE *head;
    	int size; 
    } STACK;
    
    void push(node *kombos, STACK *top); // (1)
    
    int main(){
    ...
    See more | Go to post

    Leave a comment:


  • miner
    started a topic Passing a pointer to a function ... how?
    in C

    Passing a pointer to a function ... how?

    Hi all

    I'm doing my first steps in C and I need some help plz.

    I have 2 structs, a node* and a stack*. I want to write a push() function that accepts to arguments, the node to insert and the pointer to the the top of the stack.

    This way it works without problems: push(node *theNode, stack *theStack)
    The call looks like that: push(newNode, newStack) and inside the function I can access the pointer...
    See more | Go to post
No activity results to display
Show More
Working...