Ask user to key in brand, and use a validatebrand() to check whether it's valid or not, if it is valid, return the brandName. But when it is return, and i tried a printf to check what's returned in the main(), i found out tat it's not returned the exact data but the address. How i am going to make the validatebrand() to return the entire valid data after validated? Can anyone point it out?Code:int main(void) { char brand[20]; printf("Enter brand: "); brand = validatebrand(); } char * validatebrand() { char brandName[20]; ..... ....... ...... if( (strlen (brandName)) >= 1 && (strlen (brandName)) < 20) { return brandName; <-- this is the warning } else { return NULL; } }
Thanks