Hello.
This is a simple program that imports a custom header file called 'myfunc.h,' which contains a defined prototype for an alternative strcmp function.
The code for the .c file is:
and this is the header file:Code:#include <stdio.h> #include <stdlib.h> #include "myfunc.h" int main(void) { char* string1 = {0}; char* string2 = {0}; printf("Enter string1: "); scanf("%s", string1); printf("Enter string2: "); scanf("%s", string2); if (compstring(string1, string2) == 1) { printf("The two strings you entered are the same.\n"); } else { printf("The two strings you entered are different.\n"); } system("pause"); return 0; }
Here is the resulting error:Code:#include <string.h> int compstring(char* str1, char* str2) { if (strcmp(str1, str2) == 0) { return 1; } else { return 0; } }
Any ideas on what could be causing this? Thanks in advance.



1Likes
LinkBack URL
About LinkBacks




