problem in program for counting no of chars using pointers

Hi all, I was trying to make a program which counts number of chars in a string using concpt of pointers. Following is the code:

#include<stdio.h>
#include<conio.h>
void main()
{
char *ptr1;
int ctr=0;
clrscr();

printf("Enter the string");
gets(ptr1);
while(1)
{

if(*ptr1!='/O')

{ *++ptr1; // *ptr1++;
ctr++;}
if(*ptr1 ='\0')
{
break;}
}
printf("Total chars are %d",ctr+1);
getch();
}

Above program compiles w/o errors but gives 2 warnings :
Line 14: Constant out of range in comparison.
Line 18: Possibly incorrect assignment.

I think I code it perfectly and I fail to interpret these warnings.
Note: If I execute the program ignoring the warning then once I pass the string the system comes to an halt and to come out I have to press ctrl+Pause break.
Pls help me to fix the error.....

Thanks
Line 14: You have '/O' instead of '\0'
Line 18: You must use == for comparison, = for assignment

Other things:
don't use conio.h, see http://www.cplusplus.com/forum/articles/10515/ and http://www.cplusplus.com/forum/articles/7312/
main should return int, not void ( then add return 0; at the end of main
When posting code, use [code][/code] tags
thanks
What's wrong with str.length()
Topic archived. No new replies allowed.