Untitled

 avatar
unknown
plain_text
2 years ago
602 B
5
Indexable
#include <stdio.h>
#include <string.h>
#include <ctype.h>
struct stable{
	int type;
	char v;
} st[3];
int main(){
	int i=0,j=0,k=0,m=0;
	char ch = 'a', temp[20];
	int flag=0;
	printf("\n Enter 3 lines emded by ;:\n");
	while(i<3){
		do{
			scanf("%c", &ch);
			if(isalpha(ch)){
				temp[j++]=ch;
				if(flag==1)
				st[k].v = ch;
			}
			if(ch == ' '){
				temp[j] = '\0';
				if(!strcmp(temp,"int"))
					st[k].type=1;
				if(!strcmp(temp,"float"))
					st[k].type=2;
				if(!strcmp(temp."char"))
					st[k].type=3;
				j=0;
				flag = 1;
			}
			if(ch==' ')
		}
	}
}
Editor is loading...