Results 1 to 3 of 3

Nid Help in my Programming (turbo C).... i nid help.... geniuses!!!


This discussion is about "Nid Help in my Programming (turbo C).... i nid help.... geniuses!!! " in the "Programming" forums.
...

  1. #1
    Junior Member
    Join Date
    Feb 2005
    Posts
    33

    Default Nid Help in my Programming (turbo C).... i nid help.... geniuses!!!


    I need help in this turbo C codes of mine..(puros ni functions) ....i hope makatabang pud mo nako kay nag-labad na gyud ako ulo ani sigeg huna2x .... I hope butangan ninyu ug mga comments nano error ug nano sayup..... para makasabot pud kog maayu!!!¬* i don't know why errors come up with this functions..... so here they are....


    #define MAX 100
    #define LEN 50


    typedef char elementtype[MAX][LEN];
    typedef struct
    {
    elementtype data;
    int top;
    }Stack;
    Stack S;



    char *reverse_string(char str1[])
    {
    Stack *stemp;
    char *temp;
    int n;
    initialize(stemp);

    ¬* for(n=strlen(str1)-1;n>=0;n- -)
    ¬* ¬*{
    ¬* ¬*push(str1[n] , stemp); //Error: cannot convert 'int' to 'char'¬*
    ¬* ¬*}

    return *(stemp->data);
    }

    void initialize(Stack *S) // this function does intitialize my structure to 0... basta "starting place ni"
    {
    S->top=MAX;
    }

    void push(char ch, Stack *S) //this function just would push characters into my Stack... basta i-sulod ang akong mga data
    {
    ¬* if(S->top!=0)
    ¬* ¬*{
    ¬* ¬* S->top--;
    ¬* ¬* S->data[S->top] = ch; // Error: Lvalue required daw ingun ang computer? wa ko kasabot...¬* ¬*
    //Error: Typemismatch pud..... str daw....

    // Ngari gyud ko nga point wala kasabot..... mura dli man mo-accept ang computer sa¬* ¬*
    // akong mga statements specially ang pag assign nako sa 'ch'......¬* ¬*

    ¬* ¬*}
    ¬* else printf("Warning: StacK is Full!!!");
    }




    I'm waiting and hoping sa inyung mga comments....... kahibaw ko makatabang na sa akong skwela...^_^ TY da-an....






  2. #2
    Site Keeper BadDudes's Avatar
    Join Date
    Sep 2003
    Posts
    1,427

    Default Re: Nid Help in my Programming (turbo C).... i nid help.... geniuses!!!

    moved
    ALONE:Hated and Punished

  3. #3
    C.I.A.
    Join Date
    Jun 2005
    Posts
    2,818

    Default Re: Nid Help in my Programming (turbo C).... i nid help.... geniuses!!!

    Quote Originally Posted by JonG2x

    typedef char elementtype[MAX][LEN]; < ----- This is an array of string
    typedef struct
    {
    elementtype data; <-----So this is an array of string also.You must assign a string (i.e. char *str, char str[])
    to this data

    int top;
    }Stack;

    S->data[S->top] = ch; // Error: Lvalue required daw ingun ang computer? wa ko kasabot... <-------
    About this
    typedef char elementtype[MAX][LEN];
    elementtype data;

    Are you trying to have a stack for characters? Or stack for strings?

    Try to compare the one you assigned....

    Problem:

    S->data[S->top] = ch; --->You assign a character value to a double dimensional array of characters variable which is the
    equivalent of single dimensional array of strings. So meaning the error exist coz you
    assign a char data to an array of string which is wrong.

    Solution:

    a)
    If this program is for stack of characters:

    typedef char elementtype[MAX];

    This is the correct assignment
    S->data[S->top] = ch;
    b)
    But, if this program is for stack of strings

    S->data[S->top] = ch; --> revise this assignment for example, S->data[S->top][Another Counter] = ch

    Or

    S->data[S->top] = string; --> Assign this variable to a string data type (i.e. char *str, char str[])


    So is your stack has maximum limit??

  4.    Advertisement

Similar Threads

 
  1. Help in my wedding
    By Nabz in forum Parties & Events
    Replies: 23
    Last Post: 07-05-2010, 09:58 PM
  2. help in my motherboard
    By toypitz in forum Computer Hardware
    Replies: 3
    Last Post: 10-06-2009, 02:59 AM
  3. need help in my webcam!!!
    By mikhailbogz in forum Software & Games (Old)
    Replies: 9
    Last Post: 03-22-2009, 02:00 PM
  4. need help in java programming: creating a folder
    By rastaman81 in forum Programming
    Replies: 4
    Last Post: 03-11-2009, 08:51 AM
  5. help, in flash programming, exploding pixel map.
    By emailroy2002 in forum Programming
    Replies: 6
    Last Post: 05-23-2007, 06:08 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top