C++ problem: goto and label?

It's a part of my program

for (i=0;i<strlen(a);++i)

for(j=0;j<strlen(b);j++){

if(a[i]==b[j]){

goto oopoo;

}

}

oopoo: printf("YES");

my problem: I want when one common character in any position is the same for array a and array b , my loop terminates and print yes.

when I use break in inner "if" it just terminates if and then checks for other i and j.

so I used goto . but it prints "yes" even when there is not common character between array a and array b.

how can I solve it?

Please enter comments
Please enter your name.
Please enter the correct email address.
You must agree before submitting.

Answers & Comments


Helpful Social

Copyright © 2025 Q2A.ES - All rights reserved.