You're getting some pretty good answers so far, so consider this to be in addition to what you already have...
Originally Posted by bluej322
Because a string is just an array of characters with a 0 after the last used slot.
1) Why don't I need to place a '&' before strings when using scanf()?
The name of an array is a pointer to it's first element.
However the name of an integer returns it's value, it is not a pointer.
So when you are using scanf() for integers you need to make it into a pointer with the "Address of" operator ... &... but since a string's name is already a pointer you don't need to do that.
You can't do this directly because integers are storead as binary values. They only display as character strings for our convenience.
2) How can access individual characters in an integer? (e.g. - find the occurrences of 4 in the integer 142342)
The easiest way to access individual digits is to convert it to a string with functions such as sprintf(), etc. then use cell addressing -- string[x]-- to pick characters from the resulting character array.
C is a language without real strings. As I mentioned above, what we call a "string" in C is actually just an array of characters with a 0 after the last used space. Since a "string" is not a native type in C you cannot manipulated it with the operators used for native types. Thus, we have a number of library functions that do string-like operations on char arrays... string.h
3) How can I assign string to a variable after its initial declaration?
when i try to compile:
char string = "First";
string = "second";
test.c: In function ‘main’:
test.c:10: error: incompatible types in assignment
Move each character after the offending character forward one space. Generally this is done with a for() loop but you can also concoct while() loops to do the job as well.
4) How can I blank out an element of an array? (e.g. - remove the 'b' in "qubestion")
You mean like Windows and Linux? Both were written in C and are available to C.
5) Are there any GUI's for C?
Well... please understand that a couple of questions here and there is a fun thing. But this isn't an online programming course, there are limits... If you don't already have books and tutorials on C, you should start reading... it's a fascinating language that has stood the test of time quite well.
I know i have a few more but I can't remember them at the moment. Thanks in advance.