i asked this on the C++ forum but someone told me to try it here on C.
here's my first program there are some error with this program, i can't debug it. what's the problem?
#include <stdio.h>
#include <conio.h>
#include <ctype.h>
#include <string.h>
int main(void)
{
int strlen, a, b,c;
int data_type, var;
char dtypechecker;
char *str;
clrscr();
data_type=0;
var=1;
b=0;
gets(str);
str+='\0';
}
bool is_alpha(char ch)
{
return (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z');
}
for(a=0;a<strlen;a++)
{
if(data_type!=1)
{
if(str[a]==isalpha)
{
dtypechecker[b]=str[a];
b++;
}
if(str[a]==':')
{
}
if(b==0)
{
//do nothing
}
else
{
dtypechecker==[10];
switch(dtypechecker)
printf("int\t data ytpe case 'int': var=0");
printf("int\t data ytpe case 'char': var=0");
printf("int\t data ytpe case 'float': var=0");
printf("int\t data ytpe case 'double': var=0");
printf("int\t data ytpe case default=data type error");
error==1;
}
if(error!=1)
{
else
{
exit(1);
}
}
}
if(var!=1)
{
if(str[a]==isalpha)
{
varchecker[c]==str[a];
c++;
}
}
else if(str[a]==isdigit)
{
if(c==0)
{
error=1;
}
else
{
varchecker[c]==str[a];
c++;
}
else if(str[a]=='*')
{
if(c==0)
{
varchecker[c]=str[a];
printf("\n\t*\t pointer");
c++;
}
else
{
error=1;
}
else if(str[a]==',')
{
if(c==0||str[a+1]==';')
error=1;
}
else
{
for(d=0;d<c;d++)
{
printf("\t variable\n");
printf("\t separator \n");
}
else if(str[a]==';')
{
if(a+1!=strlen(str);c==0)
{
//error replacing semi colon
printf("\n\tlexeme\t\t token");
printf("%s",dtypechecker);
printf("\t data type \n");
}
else
{
for(d=0;d<c;d++)
{
printf("%c",varchecker);
printf("\t variable");
printf(";\t semi colon");
}
}
}
}
}
}
return 1;
}