It has gone over variables which are of types int and/or float, and the book calls printf's "string literals"
The parameters and arguments it has not covered yet. However, when I get errors in my compiling, often it makes reference to "invalid argument". So since I did not know what an argument was, I looked it up. But it seemed confusing because I interpreted the argument as being the "statement", or "string literal" in double quotes that followed the printf of scanf functions. Which is why I wanted clarification on whether what I considered "strings" to be the same thing as arguments. Or maybe their not strings at all, but rather arguments.
Same with parameters, I looked them up also, as the book hasn't covered them yet. But I understood what I read as basically being the same thing as a variable.
=( Hm.
This is a bit difficult to clear up in a non-interactive setting such as this.
printf is a function. It takes parameters (which you can also call arguments). The first one is a format string. It is generally a string literal (in "s). It does not have to be a literal, you can build up a format string elsewhere and pass that in. In this case, the string literal that appears immediately after the ( in your printf is the first parameter. It is a "string" i was just trying to be precise in the way C handles strings, because there are other languages with "proper" strings that are a lot better controlled that null-terminated "C strings". So:
Code:
#include <stdio.h>
int main(int argc, char *argv) {
int x = 7;
int y = 9;
printf("This is the format string, argument one to printf. x: %d, y: %d\n",x,y);
}
In this segment main accepts two parameters, argc and argv. We are calling printf and passing it three parameters. The first is the string literal used as the format string, the second being the int variable x, the third being the int variable y.
There are no variables that are int and float, but i don't think that's what you meant. There are other types, too, but if that's all they've introduced, that's fine. An argument/parameter can be any type, including the string literals, ints, floats, and others.
"and the book calls printf's "string literals" " this doesn't make sense to me. printf is a function. The first argument/parameter can be a string literal. printf is not a string literal, it is the name of a function.
This may not explain things clearly enough. Keep asking in different ways and we'll get there. At this stage there's a lot of things going on that have not been explained and you're trying to wrap your head around all of them. Things will hopefully fall into place soon.
-Lee