主题:[讨论]这个程序为什么不能循环呢?
代码如下:
#include <stdio.h>
#include <string.h>
void main()
{
const char *key = NULL ;
const char *val = NULL ;
char ch = 'y';
do
{
printf(" Input the key:");
scanf("%s",&key);
printf("Input the val:");
scanf("%s",&val);
printf(" key = %s. val = %s\n", &key, &val );
printf("---------\n");
printf(" Press \"y\" ,continue. Or Press \"n\" , break :\n" );
scanf("%c",&ch);
}while( ch == 'y' )
};
#include <stdio.h>
#include <string.h>
void main()
{
const char *key = NULL ;
const char *val = NULL ;
char ch = 'y';
do
{
printf(" Input the key:");
scanf("%s",&key);
printf("Input the val:");
scanf("%s",&val);
printf(" key = %s. val = %s\n", &key, &val );
printf("---------\n");
printf(" Press \"y\" ,continue. Or Press \"n\" , break :\n" );
scanf("%c",&ch);
}while( ch == 'y' )
};