struct symbolTable{
char name[symSize];
int symline;
struct symbolTable * next;
};
typedef struct symbolTable symboltable;
typedef symboltable * ST;
char * part;
Type: Posts; User: p595285902
struct symbolTable{
char name[symSize];
int symline;
struct symbolTable * next;
};
typedef struct symbolTable symboltable;
typedef symboltable * ST;
char * part;
the part I posted should do
Make a function to make a new node.
Make a function to add info to a node.
Make a function to add a node to the hash table.
anything wrong with it?
Ye I read that ,its only a part of it
My bad about bumping , I was in a hurry of trying to finish up my homework.
symbolT is a global
struct symbolTable{
char name[symSize];
int symline;
struct symbolTable * next;
};...
bring it up
char * part;
int hash;
int lnum;
struct node * new;//node has a char * name, int symline
struct node * symbolT[90];
hash_example_one(char *,int);//returns a int value
if(strcmp(part,"\n")...
so why am I copying SOMETHING to every hextable array? I only want to copy into hextable[j];
And whats the reason for malloc?
suppose
int ** hextable;
.
if((hextable =(int **) malloc(hsize))==NULL)//if failed to allocate memory
{
printf("Allocation failed.\n");
exit(1);
}
suppose I dont want the last letter in the string
char * p;
.
.
.
p=strncpy(p,p,strlen(p)-1)
p=strncpy(p,p,strlen(p)-1) this line will not work, whats the right way to do it?
if(str[1] =='a')
{
printf("second letter is a\n");
}
yes this did what I want, but I am confused here.
why 'a' not "a"
and why == not strcmp
the thing I wanted is to compare a letter in string with a char, but I have trouble with getting the single letter in string.
like
if(strcmp(&str[1],"a") ==0)
{
printf("second...
int main(void)
{
char str[]="#abd: student.asm";
char le[1];
i=0;
n = strlen(str);
while(n>0)
{
strcpy(le,&str[]);
n--;
int main(void)
{
char *str="#abd: student.asm";
printf("first = %s\n",&str[1]);
return 0;
}
why the output is
yes this worked out ! put & before p[] will get the error out
thx man
suppose
char * p;
and then you set p points to a string,
is there any way to get the last letter in p?
char **pStrings = malloc(NumberOfElements * sizeof(char*));// does this line means to create space for NumberOfElements of char pointers?
Would you mind to show me a example of mallocing pointer array?
I want a array list with pointers
like [0]-> -> -> ->
[1]-> -> -> ->
[2]-> -> -> ->
.
.
.
which can increase itself when it reached its limit
what shall I do?...
suppose I had
char * lines[50];//create 50 char pointers
how can I increase to 100 or more char pointers?
how do you check the thing you read in from file is int or char?
the file contains 4 byte int
ye I found it wrong and I changed it
Oh i know how to do it now
fread (&int,sizeof(int,1,dat));
int will be an int hahaa
thx bro
it prints out
0
for v. guess can not use atoi for converting
else if ((strcmp(t,"I"))== 0)
{
fread(n,sizeof(int),1 ,dat);//read tuple from dat
v= atoi(n);
...
str can be printed and it works fine :D I think you told me to use relation[x].nemae yesterday thx man
while(fgets(line,Char,que)!=NULL && strcmp(line,"quit") !=0)//when the command is not eof
{
strcpy(curline,line);
// printf("curline= %s\n",curline);
...