[LCP]Very Small Doubt...

Goverthanan verthan at miel.mot.com
Mon Jul 8 18:57:06 UTC 2002


hi all,
this is a very small doubt in c.
On execution the following program throws segmentation fault error.

#include <stdio.h>
#include <string.h>

main()
{
int n;
char *str, *str1;
scanf("%s", str);
scanf("%s", str1);
scanf("%d",&n);
printf("%d\n", bcmp(str, str1, n));
}

Instead when the order of variable declaration is changed, program worked
fine.

May i know what makes the diffenence in the order of variable declarations.

Regards,
Goverthan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.linux.org.au/pipermail/linuxcprogramming/attachments/20020708/48c22051/attachment.htm 


More information about the linuxCprogramming mailing list