Need help with pointers?

I've fixed most problems that I got help on,
but now if I compile, the program will crash with no warnings or anything.
Perhaps it's because I am screwing up my pointers but I can not figure out why.
Thank you for your help!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
//function declarations.
#include <stdio.h>
int sizeofstring(char *given);



void main()
{
	int answer1 = 0;
	char *fivep = "abcde";
	char *sixp = "abcdef";
	answer1 = sizeofstring(fivep);
	printf("-> %d\n", answer1);

}

int sizeofstring(char *given)
{
	int counter = 0, a = 0;
	for (a = 0; given[a] != '/0'; a++)
	{
		counter = counter + 1;
	}
	return counter;

}
Line 20: You should be looking for the null terminator '\0'. Instead, you're looking for a match on an int value of 0x2F00. Your loop continues past the end of your strings causing an exception because it doesn't find that value in your strings.
Wow embarrassing...
Thanks for the help! Hopefully it will work this time!
Topic archived. No new replies allowed.