Q:

what is wrong with pointer notaton

The problem I am facing is that when I use pointer notation and run the code it displays nothing and when I use array notation it displays the desire result. I don't know what is wrong with the pointer notation.
#include <iostream>
#include <cctype>
#include <cstring>

using namespace std;

int main()
{
    char str[30] = "PROGRAMMING IS FUN";
    char* ptr = str;
/*
    int count=0;

    while(ptr[count] != '\0')
    {
        ptr[count] = tolower(ptr[count]); 
        count++;
    }

    cout<<ptr<<endl; // result is displaying
*/

    while(*ptr != '\0')
    {
        *ptr = tolower(*ptr); 
         ptr++;
    }   

    cout<<ptr<<endl; // nothing is displaying also no compiler error

    // ptr[0] and ptr[1] als0 displays nothing.
}

A:

When the while loop breaks, ptr is pointing to the zero byte at the end of the string. That's what while (*ptr != '\0') does. So when you try to output ptr, you're outputting an empty string. Output str instead.

