#include <stdio.h> #include <string.h>
void TestFun(char a[100]) { printf("before addr:%p\n", a); // Printing a Address of
//a = "very good"; // error . String cannot be assigned directly to character array ,a 's address has changed . It is estimated that the system is a Open up new memory space ."very
good" The lifetime of is from the beginning to the end of the process //a[0] = "very good"; // error .a The address of will not change , Can be changed a[0] Value of
strcpy(a, "very well"); // correct
/* a[0] = 'v'; // correct . Assign values one by one a[1] = 'e'; a[2] = 'r'; a[3] = 'y'; a[4] = ' ';
a[5] = 'g'; a[6] = 'o'; a[7] = 'o'; a[8] = 'd'; a[9] = '\0'; */
printf("after addr:%p\n", a); // Printing a Address of printf("%s\n", a); }
int main(void) { char TestStr1[60] = {"abchij"}; char TestStr2[] = {"abchij"};
char TestStr3[100] = {65,66,67};
//strcat(TestStr1 , TestStr2);
printf("main before TestStr3:%s\n", TestStr3); TestFun(TestStr3); printf("main
afterTestStr3:%s\n", TestStr3);

getchar(); return 1; }
stay vs2010 Run results in : main before TestStr3:ABC before addr:003EF7A4 after
addr:003EF7A4 very well main after TestStr3:very well
summary : It can be used { printf("after addr:%p\n", a); // Printing a Address of } To print a pointer , Or the address of the array name .

©2019-2020 Toolsou All rights reserved,
Redis Underlying data structure A person who dissuades others from learning computer , Are not good people win10 System computer C Where's the disc ,c disc users where? (win10c Disk not found users) Freshman c Language student management system ( lower ) hospital WIFI Which family is strong ? utilize Python Script unlimited spoof girlfriend computer C language program design —— Student management system Byte runout - Test development practice - One side cool meridian python Run code at specified time 5 Best style Linux Server system recommendation Anti anxiety life after naked resignation , I believe everything will have the best arrangement