Write a c program to compare two strings without using builtin function?

1 answer

Answer

1047724

2026-05-02 09:05

+ Follow

A string is a character array, so you can compare them one character at a time:

String x = "test"

String y = "test"

for(int i = 0; i < x.length && i < y.length; i++)

{

if(x[i] != y[i])

return false;

}

return true;

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.