View Single Post
Old Mar 29th, 2006, 7:23 AM   #1
Uday
Programmer
 
Join Date: Oct 2005
Location: India
Posts: 30
Rep Power: 0 Uday is on a distinguished road
Problem with strings

This program is not terminating. Can anyone tell me what is the problem with the code.

#include<Stdio.h>
#include<String.h>
void main()
{
int i=0;
char str1[10];
clrscr();
printf("Enter string1");
scanf("%s",str1);
for(i=0;str1!='\0';i++)
{
printf("%d",i);
}
getch();
}

Is that all strings end with the null character '\0'
Uday is offline   Reply With Quote