CtCi 2.6: Implement a function to check if a linked list is a palindrome
Don't use using namespace std;. See any other C++ question for the reasons.

The declaration createSampleList(string str) means that when you pass a string to that function, the whole string will be copied. That's unnecessary. Declaring the function as createSampleList(const string &amp;str) is much more efficient.

The variable name tempStack can be improved. The word temp should not appear here at all, since it doesn't explain anything about the code.

I was first confused on why you called tempStack.pop() two times in a row. But then I saw that it was top and pop. There's nothing you can do against that, since the C++ API just doesn't provide the method that combines these two. Maybe you could move the tempStack.pop() below the if sentence.

The char reverseVal line is not indented properly. Let your IDE fix the indentation.

After each if, there should be a space. Only for function calls the space should be omitted.

A general rule is that you should not use global variables. The global variable in this case is head. It is better to pass such variables as parameters. This corresponds to natural language speaking, where you would ask Is the word asdfdsa a palindrome? instead of Is the word written at the wall over there a palindrome?. This makes your code much more flexible.

The rest of the code looks great for learning algorithms. If you want to use that code in practice, it should be much shorter. Something like this:

#include &lt;cassert&gt;
#include &lt;string&gt;

bool is_palindrome(const std::string &amp;str)
{
    std::string rev(str.rbegin(), str.rend());
    return str == rev;
}

int main()
{
    assert(is_palindrome(""));
    assert(is_palindrome("a"));
    assert(is_palindrome("aa"));
    assert(!is_palindrome("ab"));
    assert(!is_palindrome("aaabcaaa"));
}