形参、实参、返回值

// hellopoint.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"
#include <stdio.h>
#include <malloc.h>
#include <string.h>
char* GetMem(int nsize);
void GetChar(char*p );
int _tmain(int argc, _TCHAR* argv[])
{
    char* temp=NULL;
    temp=GetMem(18);

 
    printf("
temp add  %x  内容如下%s",&temp,temp);

    char *temp2=NULL;
    GetChar(temp2);
    printf("
%s",temp2);
    printf("
temp2 add  %x  内容为 %s",&temp2,temp2);

    while (true)
    {
    }
    return 0;
}

char* GetMem(int nsize)
{
    char* p=NULL;
    p=(char*)malloc(sizeof(char)*nsize);
    
    strcpy(p,"here is ok");;
    printf("
p  add %x context is %s",&p,p);
    return p;
}


void GetChar(char*p )
{
    p=(char*)malloc(sizeof(char)*18);
    strcpy(p,"here is 2222");
    printf("
 GetChar p2 add %x  context is %s",&p,p);
}



原文地址:https://www.cnblogs.com/songtzu/p/3574706.html