Frage im Vorstellungsgespräch bei NXP Semiconductors

Write a string compare program in C.

Antworten zu Vorstellungsgespräch

Anonym

21. Dez. 2015

Write a program to find bit pattern in a given string. A couple of questions related to 'volatile' keyword.

4

Anonym

15. Okt. 2016

//String comparison #include #include int func(char* str1, char* str2) { int ret = 0; ret = strcmp (str1, str2); } int main() { int result = 0; char str1[] = "XYZD"; char str2[] = "XYZD"; result = func(str1, str2); if (result < 0) { printf ("\n %s is less than %s", &str1, &str2); } else if (result == 0) { printf ("\n %s is equal to %s", &str1, &str2); } else { printf ("\n %s is greater than %s", &str1, &str2); } return 0; }

1