The first case you showed
struct str {
int a;
float b;
};
is the definition of a structure that can be used anywhere in your program. But as a definition it does not create anything, it just defines some information for the compiler.
In the scond case
struct {
int a;
float b;
} str;
you have defined the structure, but also declared a variable of that structure, so space will be allocated for it in the program. Note that this is an anonymous structure (it has no structure name) so it cannot be used elsewhere.