I know there are a lot of questions here, but if anyone can post some responses to any/all, i would be extremely appreciative. I don't understand these things at all. I'm very new to programming.
Ok...
Let's start off with declaring strings and pointers.
void main(void) {
char string1[70];
char *pointer1, *pointer2;
char string2[70];
pointer1 = &string1;
pointer2 = &string2;
ok, tell me if i'm reading my code correctly.
pointer1 = the address of string1????
*pointer1 = 1st value of string1????
2nd question.
let's say I have string4[] = "hello";
char *pointer4;
pointer4 = &string4;
I want to use the 2nd value of the string...so would I use the notation:
*(pointer4 + 1); would this give me the 'e' value?
3rd question.
I've come across a gets() function.
It inputs a string from a user. How exactly does this work?
Let's say I wanted to input my string1 value using gets().
Would this work?
char gets(*pointer1);
4th question:
I've come across another function... isAlpha();
I can't figure this one out either.
Let's say I wanted to check a string of int, char, and float values... and put all of the char values into another string.
Would this work?
for(int i=0; i<70;) {
if(isAlpha(*(pointer1 + i))) {
*(pointer2 + i) = *(pointer1 + i);
i++;
}
else
i++;
}