how to check for '\'?

This function returns the position of line where '\' appear. I tried '\' it woudln't compile i go to the ascii table and found out \ = 0x3c. but instead it's actually 60 soooooooo what now lol
1
2
3
4
5
6
7
8
9
10
11
12
 int check_slash(char *lines){
	unsigned int counter = 0;
	unsigned int one_check = 0;
	for (int i = 0; i <= (length(lines)-1); i++){

		if ((lines[i] == 0x3c) & (one_check == 0)){
		counter = i;
		one_check++;
		}	
        }        
	return counter;
}
http://en.wikipedia.org/wiki/Backslash


It is equal to 92 at ASCII table.
The reason it probably didn't compile is that the backslash is used for escape sequences so you must use the escape sequence then another backslash to tell the compiler it is a backslash.

TLDR; char backslash = '\\';
http://msdn.microsoft.com/en-us/library/6aw8xdf2.aspx
Topic archived. No new replies allowed.