What is wrong with this code:

#include <stdio.h>
#include <string.h>
#define MODULUS 11

void main()
{
char code[] = "24686", weight[] = "23456", *wgt_ptr = weight[ ( strlen( code ) - 2) ];
int loop, tot = 0;

for( loop = 0; loop < ( strlen( code ) ) - 1; loop++ )
{
tot = ( ( code[loop] - '0') * ( ( wgt_ptr-- ) - '0' ) );
}
tot = MODULUS - ( tot % MODULUS );
if( tot != code[ strlen( code ) ] )
printf("Invalid code");
}

I think the problem lies with if( tot != .....

What I want is for a function to be able to validate code[] using a modulus of 11 and a weight factor of 5432 if code[] is 5 characters long and 65432 if code[] is 6 characters long.

By the way code[] wouldn't be a fixed literal normally that was just for the sake of testing it.

T