+ 2

Why function disp() cant accessible?

I created a program by using structure. In this program main function executes untill for loop end. After that it doesn't execute. Why? https://code.sololearn.com/c2diqAXffIQk/?ref=app

29th Jan 2021, 12:31 PM
Jawahirullah
Jawahirullah - avatar
3 Réponses
+ 2
On line 16 if(b[i].depart==copy) You are trying to compare 2 c-style string with an equality(==) operator which will not give intended result, as equality operator will compare if both pointers(*b[I].depart* and *copy* who are pointing to first elements of following strings) are pointing to same object or not and have nothing to do with values in them. Either perform the string comparison manually or make use of inbuilt function strcmp() { from c library string.h } to get the intended results. here is the fix https://code.sololearn.com/cDe7WCzF5fxe/?ref=app
29th Jan 2021, 1:09 PM
Arsenic
Arsenic - avatar
+ 2
Martin Taylor fixed Thanks for pointing that out 🙂
29th Jan 2021, 1:33 PM
Arsenic
Arsenic - avatar