17th Dec 2023, 4:23 PM
Viraj Yadav
Viraj Yadav - avatar
3 Answers
+ 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.
18th Dec 2023, 8:59 AM
Brian
Brian - avatar
+ 8
Use Feed Posts for review code.
17th Dec 2023, 5:15 PM
JaScript
JaScript - avatar
+ 2
Thanks bro
20th Dec 2023, 3:29 PM
Viraj Yadav
Viraj Yadav - avatar