Compare One String With the Multile Strings with for loop

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • faz1786
    New Member
    • Mar 2019
    • 1

    Compare One String With the Multile Strings with for loop

    I have to complete my assignment and i have a trouble to compare one string to the multiples string..
    example i have array of string like string Regno[5];
    and I want to search one reg no from them for this i create an another string Which is string opt;
    now i want to compare this opt with regno[5] in a if statement..plz hgelp me in this matter.
  • dev7060
    Recognized Expert Contributor
    • Mar 2017
    • 656

    #2
    strcmp() is such a function for comparison. But it expects arguments in char* form, not in the string form. Therefore, you may need to convert your string first to char array.

    Comment

    Working...