You were right it was the new line :-). I've fixed it and it works perfectly now.. thanks for all the help !
Let me know if I could've done this in a better way:
Code:for(i=0;sent[i];i++){ if(sent[i] == ' ') sent[i] = ' '; else if((sent[i] + a) > 'Z') sent[i] = 'A' + ((sent[i] + a) - 'Z')-1; else if(!(isalpha(sent[i]))) sent[i] = ' '; else sent[i] += a;