Hi,
Please excuse me for asking such a trivial question. I am very new to C programming and it would be very helpful if someone answers my question.
Here is my program ...
Code:
#include"scanner.h"
#include<stdio.h>
#include"scanner.c"
#include<stdlib.h>
#include<string.h>
#define MAX_TOKENS 10
int main(int argc, char **argv){
int datatype, counter;
int index = 0;
char *my_argv[MAX_TOKENS];
while((datatype = yylex()) != 6)
{
printf("\nData :%s",yytext);
printf("\nData type :%d\n",datatype);
my_argv[index++] = yytext;
}
printf("\n%s",my_argv[0]);
printf("\n%s",my_argv[1]);
}
Here yytext is of type char*. I store it in my_argv[]. Consider yytex returns "abc" and then "def". I should be getting the output as
abc
def
but instead I get
abc def
def
Can anyone explain me this !!
Thanks in advance.