-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
37 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
###c/c++练习的文件库,存放在git做收集 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#include <stdio.h> | ||
#include<unistd.h> | ||
#include<time.h> | ||
int main(int argc, char *argv[]) | ||
{ | ||
clock_t t1,t2; | ||
t1 = clock(); | ||
sleep(5); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,28 @@ | ||
#include <stdio.h> | ||
#include <string.h> | ||
1 #include <stdio.h> | ||
2 #include <string.h> | ||
3 | ||
4 | ||
5 const char g_ip[32] = "123456789"; | ||
6 int func1(const char *ip) | ||
7 { | ||
8 printf("ip:%s\n",ip); | ||
9 printf("ip size:%d\n",sizeof(ip)); | ||
10 if(*ip == '\0') | ||
11 printf("ip is none\n"); | ||
12 printf("g_ip:%s\n",g_ip); | ||
13 printf("g_ip size:%d\n",sizeof(g_ip)); | ||
14 if(*ip == '\0') | ||
15 printf("g_ip is none\n"); | ||
16 return 0; | ||
17 } | ||
18 | ||
19 int main() | ||
20 { | ||
21 const char ip[32]="ABCDEFG"; | ||
22 func1(ip); | ||
23 return 0; | ||
24 } | ||
|
||
|
||
const char g_ip[32] = "123456789"; | ||
int func1(const char *ip) | ||
{ | ||
printf("ip:%s\n",ip); | ||
printf("ip size:%d\n",sizeof(ip)); | ||
if(*ip == '\0') | ||
printf("ip is none\n"); | ||
printf("g_ip:%s\n",g_ip); | ||
printf("g_ip size:%d\n",sizeof(g_ip)); | ||
if(*ip == '\0') | ||
printf("g_ip is none\n"); | ||
return 0; | ||
} | ||
|
||
int main() | ||
{ | ||
const char ip[32]="ABCDEFG"; | ||
func1(ip); | ||
return 0; | ||
} | ||
/* | ||
通过函数传递进去的参数并不会依照定义时候的大小 | ||
*/ |