Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   can u tell me the problem (http://www.go4expert.com/forums/tell-t1265/)

ismitevijay 26Aug2006 15:27

can u tell me the problem
 
can anyone tell me where the err is :'

#include<stdio.h>
void set(char *items[]);

int main()
{
char *items[]={"apple","pear","banana","grape"};
set (items);
return 0;

}

void set(char *items[])
{
printf ("\t%s\n", items[2]);
}

this prog compiles without segmentation fault; and gives "banana " as o/p.

but when i giv
#include<stdio.h>
void set(char *items[]);

int main()
{
char *items[10];
gets(items[2]);

set (items);
return 0;

}

void set(char *items[])
{
printf ("\t%s\n", items[2]);
}

but when i try to gets the names : i get segementation fault;
plz help

shabbir 26Aug2006 15:57

Re: can u tell me the problem
 
Duplicate of CAN U TEll me the problem. Thread closed.


All times are GMT +5.5. The time now is 16:57.