How to write below code in C? Also: is there any built in function for checking length of an array?
Python Code
x = ['ab', 'bc' , 'cd']
s = 'ab'
if s in x:
//Code
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There is no function for checking length of array in C. However, if the array is declared in the same scope as where you want to check, you can do the following
You have to iterate through x and do strcmp on each element of array x, to check if s is the same as one of the elements of x.