This is a little program I'm writing to refresh my knowledge of C and I know it's wrong, but everything I've tried in order to fix it isn't working.
#include <stdio.h>
#include <string.h>
int main() {
int const STR_LENGTH = 255;
char str[STR_LENGTH];
int n=0,i=0;
printf("Please enter a word: ");
scanf( "%s", str);
for(i = 0; i < STR_LENGTH; i++){
if(!str[i] == "\n"){ //if char does not equal newline char
n++; //counts all characters besides newline
printf("%c", str[i]);
}
else
i = STR_LENGTH; //this will quit the for loop
}
printf("\nThe word you entered is: %s", str);
printf("\nThe number of characters besides the newline are: %d\n", n);
getchar();
return 0;
}