C 342 golfed
#include <stdio.h>
#define N 100
#define P(x) printf("%s\n",x)
#define G(x) gets(x)
void e(int x){x?P("y"):P("n");}
int main(){
char s[N],t[N];char *p,*q;int r=0; int n=0,m=0;int i=1;p=s,q=t;
if((p=G(s))&&(q=G(t))){while (*p){n+=i*(int)*p;m+=i*(int)*q;i++;p++;q++;if(!(*q)){break;}}
if(!*p&!*q){if(!(m-n)){r=1;}}e(r);}
return 0;
}
Note: Visual Studio complains if you don't use their safe methods eg gets_s. CodeBlocks with mingw compiles without warnings.
C 655 not golfed
Code creates weighted sum of chars for each string. If the difference is zero then they are equal, including 2 empty strings:
#include <stdio.h>
#define N 100
#define P(x) printf(x)
#define G(x) gets_s(x)
void e(int x){ x ? P("equal\n") : P("not equal\n"); }
int main()
{
char s[N], t[N];//words
char *p = 0, *q = 0;
int r = 0; //result 0=false
int n=0, m=0; //weighted sums
int i = 1; //char pos start at 1
if ((p=gets_s(s)) &&
(q=gets_s(t)))
{
while (*p)
{
n += i*(int)*p;
m += i*(int)*q;
i++;
p++;
q++;
if (!(*q)){
break;
}
}
if (!*p && !*q){ //both same length strings
if (!(m - n)){ r = 1; } //weighted sums are equal
}//else r=0, false=>not equal
e(r);
}
else{
P("error\n");
}
getchar();
}