C language, accept an int type parameters, why return value can be a char type (e.g., but can return for the best), the return value should not be like accept type int can run?
CodePudding user response:
The char estimates say here is string, rather than a single character
Such as IP address, the Ipv4, in network transmission, using 4 bytes to store, and communicate with people, may have to be converted to string 192.168.1.1, is more than 4 bytes,
CodePudding user response:
Char c means a byte, int is 4 bytes
CodePudding user response:
reference 1/f, arfi response: char estimates say here is that the string, rather than a single character Such as IP address, the Ipv4, in network transmission, using 4 bytes to store, and communicate with people, may have to be converted to string 192.168.1.1, is more than 4 bytes, Oh, oh, the string is returned char is not match with the int type CodePudding user response:
Screenshot function prototype is not complete, you want to look at the front of the statement, whether char * n_to_char statement (int), so that is converted to a string, If char n_to_char (int), it's like your initial understanding, if there is no limit to the range of int, will exist for more than a mapping, at least to lose data CodePudding user response:
Parameter types and return value type So all of your questions are not established there is no need to discuss CodePudding user response:
Return values and parameters of type no relationship CodePudding user response:
The return value of a function and to accept the argument types CodePudding user response:
Because in essence, int and char are the data on the memory, int is only 4 bytes, char is 1 byte, went up from nature, both each other without any problems, some language won't let you turn, is to protect you don't do SAO operation cause memory problems,