Re: a few doubts!



(supersedes <mn.f4557d54dfe1cbc0.15512@xxxxxxxxxxxxxx>)

maadhuu wrote on 30/04/05 :
#include<stdio.h>
#include<conio.h>
#include<string.h>
main()
{
    char * a= "bcd";
    clrscr();
    strcpy(a,"hello");
        a = "fgh";
    a[0] = 't';
    printf("%s",a);
}

Crashy!

Get a better compiler and tunings...

main.c:17: warning: return type defaults to `int'
main.c:17: warning: function declaration isn't a prototype
main.c: In function `main':
main.c:18: warning: initialization discards qualifiers from pointer target type
main.c:21: warning: assignment discards qualifiers from pointer target type main.c:24: warning: control reaches end of non-void function


--
Emmanuel
The C-FAQ: http://www.eskimo.com/~scs/C-faq/faq.html
The C-library: http://www.dinkumware.com/refxc.html

"Clearly your code does not meet the original spec."
"You are sentenced to 30 lashes with a wet noodle."
-- Jerry Coffin in a.l.c.c++

.



Relevant Pages