+ 1
Is this program good
https://sololearn.com/compiler-playground/c7Wlw0scH8N3/?ref=app
3 odpowiedzi
+ 6
Viraj Yadav the .name field remains uninitialized at the time it prints, so it shows garbage characters.
I see where it is intended to copy a string into .name, however, that statement is within the comment on line 14 so it is invisible to the compiler. Also the same line has a bug. It has the wrong type of quotation marks around the string literal. It should have double quotation marks ("<string>") instead of single quotation marks ('<single char>').
Change this
// assign value to name of p1 strcpy(p1.name,'George Orwell');
To this
// assign value to name of p1
strcpy(p1.name,"George Orwell");
See, I split the line, and I replaced the quotation marks.
+ 8
Use Feed Posts for review code.
+ 2
Thanks bro