I'm very new with C so bear with me.
Doing an assignment, I've run into a problem entering a for loop, where I get a segmentation fault.
Code:
for (i = 1; i < strlen(str); i++)
That's what the beginning of the for loop looks like, and it just never enters it. On the previous line, I print the value of strlen(str), which with the example I'm using is 2 (and gets printed as such), so it should be at least entering the loop.
I just don't understand why I would be getting a segmentation fault here. Maybe if I understood why I might be able to fix it, but I don't even understand why it happens, so that makes it a little harder to fix.
Any help would be greatly appreciated, and if more information is needed (short of posting the whole code, as I'm pretty sure that violates our academic conduct policy), just let me know.