**error: called object is not a function or function pointer (*t)–
#include<stdio.h>#include<stdlib.h>#define MAX 10int push(int stac[],int *v,int *t){ if((*t) == MAX-1) { return(0); } else { (*t)++; stac[*t] = *v; return *v; }}int pop(int stac[],int *t){ int poped; if((*t) == -1) { return(0); } else { poped = stac[*t] (*t)--; return poped; } }int main(){int stack[MAX];int value;int choice;int decision;int top;top = -1;do{ printf("Enter 1 to push the value\n"); printf("Enter 2 to pop the value\n"); printf("Enter 3 to exit\n"); scanf("%d",&choice); if(choice == 1) { printf("Enter the value to be pushed\n"); scanf("%d",&value); decision = push(stack,&value,&top); if(decision == 0) { printf("Sorry,but the stack is full\n"); } else { printf("The value which is pushed is: %d\n",decision); } } else if(choice == 2) { decision = pop(stack,&top); if(decision == 0) { printf("The stack is empty\n"); } else { printf("The value which is poped is: %d\n",decision); } } }while(choice != 3); printf("top is %d\n",top);}解决方法 你错过了一行之前错过了一个分号:
poped = stac[*t] <----- here (*t)--;
这个奇怪的错误的原因是编译器看到这样的:
poped = stac[*t](*t)--;
它可以解释为来自表的函数指针的调用,但这显然没有任何意义,因为stac是一个int数组,而不是一个函数指针数组.
总结以上是内存溢出为你收集整理的C编程,错误:被调用的对象不是函数或函数指针[已关闭]全部内容,希望文章能够帮你解决C编程,错误:被调用的对象不是函数或函数指针[已关闭]所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)