What's wrong with this piece of code:(adsbygoogle = window.adsbygoogle || []).push({});

Whever I run it, it gives exception. There's some problem in this line but I can't igure what is it:Code (Text):for (i=0; i!='\n'; i++)

{

if (isdigit(elements[i]))

{

array[i] = elements[i] - '0';

push(mystack, array);

}

}

Here's the implementation of the push function:Code (Text):push(mystack, array);

What's the problem?Code (Text):int push (stackADT stack, stack_elem_t elem)

{

static int count;

if (count == MAX_STACK_DEPTH-1)

{

stack->stk = realloc(stack->stk,2*sizeof(struct stackCDT) );

MAX_STACK_DEPTH = 2*sizeof(struct stackCDT);

}

if (!stack) {

return (ADT_INVALID_STACK);

}

if (stack->stack_ptr == (MAX_STACK_DEPTH - 1)) {

return (ADT_STACK_FULL);

}

++stack->stack_ptr;

stack->stk[stack->stack_ptr] = elem;

return (ADT_NOERROR);

}

**Physics Forums | Science Articles, Homework Help, Discussion**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Push() problem with stack

Loading...

Similar Threads for Push problem stack |
---|

C/++/# Problems with #include<complex.h> |

Running a multidimensional problem on a single core |

JavaScript Problem using dat.GUI controller library |

Fortran Fortran for Computational Fluid Dynamics Problems |

Hacking: Legal and Ethical Problems |

**Physics Forums | Science Articles, Homework Help, Discussion**