I've been trying get part of a string from a char array, and for the life of me, I cannot get any of the examples I've found on StackOverflow to work: Compare string literal vs char array I've looked all over the internet for a solution, I've tried mixing pointers, strcmp, strncmp, everything I can think of.
I cannot see how to get this to work:
#include <stdio.h>
int main(void) {
const char S[] = "0.9";
if (S[1] == ".") {
puts("got it");
}
return 0;
}
I realize posting this may ruin my reputation... but I could not find the solution.... similar articles didn't work.
thanks in advance for your help :/
EDIT: I was not aware of the correct search terms to use; that's why I didn't find the specified original.