Relative Content

Tag Archive for c++string

char s[] and char *s not the same?

I always though that char s[] and char *s were essentially the same in simple C functions.
Yet the following code gives me a segmentation fault at runtime.

Comparing a string that is reversed is not working

I am using the below function and getting the below output. Can someone please explain why.
It prints out that they are equal after the for loop finishes but when compared the logic says they are not equal.

How to add a two-digit number to stack

I am currently writing a code that inputs a function as a string from the user, coverts it to a postfix expression, then converts it to infix, then evaluates the expression.