Tags » Symbol

Symbol Table

<br />/*
input from user

Name  Type   Scope  Value
i             int       local    10

*/
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int size=0,i,flag=0;
int lookup(char name);

struct node
{
char label,scope,type;
int val;
struct node *next;
};
struct node *first,*last;

void insert()
{

struct node *ptr=(struct node*)malloc(sizeof(struct node));
int a;

printf("\nEnter Name:\n");
scanf("%s",&ptr->label);
if(lookup(ptr->label)==1)
{
printf("\nEntry already exists, duplicate is not allowed !\n");
return;
}
else{
printf("Enter Type:\n");
scanf("%s",&ptr->type);
printf("Enter Scope:\n");
scanf("%s",&ptr->scope);
printf("Enter value:\n");
scanf("%d",&ptr->val);

ptr->next=NULL;
if(size==0)
{
first=ptr;
last=ptr;
}
else
{
last->next=ptr;
last=ptr;
}
size++;
printf("\nLabel Inserted\n");

}
}

void display()
{
struct node *ptr;
ptr=first;
printf("\tName\tType\tScope\tVar_value\n");
for(i=0;i<size;i++)
{
printf("\t%s\t%s\t%s\t%d\n",ptr->label,ptr->type,ptr->scope,ptr->val);
ptr=ptr->next;
}
}

int lookup(char name){

struct node *n = malloc(sizeof(struct node));

n=first;

for(i=0;i<size;i++)
{
if(strcmp(name,n->label)==0)
return 1;
else
n=n->next;
}
return 0;
}
int main()
{
int ch;
printf("--------Symbol Table--------\n");
while (1) {

printf("\n Enter your choice \n \t 1. 38 more words
C++

North Dakota farmer plows massive Prince symbol in his field

Minnesotans have come up with a lot of ways to honor Prince, from illuminating buildings in purple to floating ideas of renaming places after the late musician. 187 more words

News

North Dakota Farmer Plows Prince's Symbol Into Cornfield (PHOTOS)

As Prince tributes go, this one is jaw-dropping. Retired farmer Gene Hanson used his tractor to plow Prince’s symbol into his cornfield and took a picture of it from his home-built plane, many news organizations have reported. 42 more words

Features

(Prose Part 2) Transcending Boundaries – Hatshepsut’s Path to Destiny by Alaya Advaita Dannu

Upon waking, the first thing I did was write this dream down. As I wrote in my journal I wondered what this could mean—not just for myself and the rest of the dreams I’ve had prior to this one, but for the collective. 1,024 more words

Goddesses

Prince and the unicorns

As I was walking across Queen Street West a couple of days ago, I saw a pink sparkly tribute to the musician Prince who died recently.   203 more words

Graffiti And Street Art

#100DaysOfAmpersands: Weekly Roundup #2

Yay the #100DayProject!

I’m on day 11 and I’m still going! I’m really enjoying it at the moment, but I think I’m enjoying the creations out of food a bit more than other materials, so I may steer more towards that. 205 more words

Typography