[ create a new paste ] login | about

Link: http://codepad.org/mDm2I50M    [ raw code | output | fork ]

nel - C, pasted on Oct 10:
#include <stdio.h>

int mystrcmp(const char *str1, const char *str2);

int main(void)
{
	char str1[] = "gay";
	char str2[] = "gayda";

	if(mystrcmp(str1, str2)) {
		printf("The strings are the same.");
	}
	
	else printf("The strings aren't the same.");

	return 0;
}

int mystrcmp(const char *str1, const char *str2)
{
	char *p1, *p2;
	unsigned temp = 0;

	p1 = str1;
	p2 = str2;

	while(1) {
		if(*p1!=*p2) return 0;
		else if(*p1=='\0' || *p2=='\0') return 1;
                *p1++;
		*p2++;
         }
}


Output:
1
The strings aren't the same.


Create a new paste based on this one


Comments: