I have a function char enterComponent()
and I would like to have it ask the user for a string name
, and then return the name to where it was called.
This is the code I have
char enterComponent(){
char name[8];
printf(" enter next component name: ");
sscanf("%s", &name);
return name;
}
and this is what the debugger tells me
warning: format not a string literal and no format arguments [-Wformat-security]
warning: return makes integer from pointer without a cast [enabled by default]
warning: function returns address of local variable [-Wreturn-local-addr]
I was wondering if someone can tell me what I did wrong here.