|
お世話になります。
Win2000+VC6.0です。
昨日よりC言語の勉強を始め、
下記のようなコードを試しに書いて
実行したところ、関数「GetInputStr」
の中でのprintfで文字列が出力されません。
どなたかヒントをお教え願えませんでしょうか?
source start ---->
#include<stdio.h>
#include<string.h>
int GetInputStr(char *p);
int main(int argc , char *argv[])
{
char s[100];
char *p;
p = s;
GetInputStr(p);
printf("Main:あなたが入力した文字列は、\n「%s」です。\n", s);
return(0);
}
int GetInputStr(char *p)
{
int i=0;
while( (*p++ = getchar()) != '\n');
*--p= '\0';
printf("GetInputStr:あなたが入力した文字列は、\n「%s」です。\n",p);
return(0);
}
<--- source end
|