Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9157393
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:00:21+00:00 2026-06-17T13:00:21+00:00

I am implementing arithmetic calculator, but I am getting errors: error: expected primary-expression before

  • 0

I am implementing arithmetic calculator, but I am getting errors:

error: expected primary-expression before ‘)’ token
error: expected primary-expression before ‘->’ token

I am posting the lines which contains the error.

    #include<stdio.h>
    #include<stdlib.h>
    #include<string.h>
    /*creating stack*/        
    typedef struct stack
    {
    int top;
    char *array;
    int max_size;
    }S;
    /*pushing character to it*/ 
    void push(S *st ,char ch)
    {
    if(st->top==st->max_size)
    {printf("already full..delete some items :)");return ;}
        printf("st->top=%d ",st->top);
        strcpy(&st->array[st->top],&ch);
        st->top++;
        printf("push=%s ",st->array[st->top-1]);
    }
    /*deleting character*/ 
    void pop(S *st)
    {
    if(st->top==0)
    {printf("it's empty..push some items :)");return ;}

        st->top--;
    }
    void fun(S *stack,S *post,char a)
    {
        while(strcmp((&stack->array[stack->top]),&a)!=0)
            {
                pop(stack);
                push(post,stack->array[stack->top+1]);

            }
            pop(stack);
    }
    int main()
    {
    int i,j;
    char str[10000];
    /*initialize 3 stacks*/
    S *st =init(10000);
    S *post=init(10000);
    S *ans=init(10000);
    / *actually code is very big so i am
    giving only lines in which there is error*/
    //some code...
    fun(stack,post,a);
    //some code...
             while(precedence(str[i])>precedence(stack->array[stack->top]))
    //some code...
    push(post,stack->array[stack->top]);
    pop(stack);
    //more code......
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T13:00:23+00:00Added an answer on June 17, 2026 at 1:00 pm

    You have a structure and a variable going by the same name stack. This is very bad and confusing you and the compiler. Use capital letters for structure/class names.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been implementing an enhanced Shunting-Yard algorithm for parsing an arithmetic expression. One aspect
Before implementing j_security_check using MySQL realm authentication in my web app. I had the
When implementing the Strategy Pattern, where does one put the code that determines which
Im implementing NFS and almoste done but the RFC section 3.3.8 says this in
I'm implementing the Pythagorean means in PHP, the arithmetic and geometric means are a
I know that the library https://github.com/clojure/algo.generic provides ways of implementing generic arithmetic operators +
I was implementing some basic complex number arithmetic in Clojure, and noticed that it
I started to write a class which would act much like the std::vector but
I am implementing a simple VM, and currently I am using runtime arithmetic to
I`m implementing a custom filesystem on Ubuntu using Fuse, but I need to trap

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.