Home > Back-end > The problems in the computer level 2 C, strives for the big help
The problems in the computer level 2 C, strives for the big help
Time:11-10
I write a code for the programming, the general idea is to make a copy of a string to b, the number of leading asterisk, Recycling loop will be assigned to the characters a, b b will be displayed after running uninitialized, check after the book is not found,
Note: the environment is a Microsoft Visual c + + 2010 Express, the header file. Only the stdio h Thank you
CodePudding user response:
Make a copy of a string to b, the need to assign b a section of memory, but not allocate memory statements in your code,
CodePudding user response:
Character arrays and character pointer is different, you want to dynamically allocated a string length + 1 character array to operation,
CodePudding user response:
A little bit more simple: Void fun (char * a) { Char * p=a;
While (* p=='*') p++; While (* p) * +=* p++; While (a & lt; P) * +='*'; }