1.Ϊʲô¶¨Ò庯Êýʱ£ºfun1 ¿ÉÒÔÕýÈ·µÄ·µ»Ø¶øfun2²»ÐУ¿
char * fun1()
{
char *p = "haha";
return p;
}
char * fun2()
{
char p[] = "haha";
return p;
}
ÊÇ·ñ¿ÉÒÔÕâÑùÀí½â£º
fun1ÖÐpÊÇÒ»¸ölocalµÄ±äÁ¿£¬ËüÖ¸ÏòÒ»¸ö¿Õ¼ä£¬¿Õ ......
C/C++ code:
#include <stdio.h>
typedef struct node{
int *key;
int length;
}node;
void insert(node &temp,int n)
{
int i,j;
for(i=0;i<=temp.length;i++)
{
if(n>temp.key[i])
break;
}
temp.length++;
for(j=temp.length;j> ......
fastshow()
{
FILE *fp;
char name[10];
char ch[512];
printf("ÇëÊäÈë´ýÏÔʾµÄÎļþÃû\n");
scanf("%s",name);
if((fp=fopen(name,"r"))==NULL)
{
printf("²»ÄÜ´ò¿ªÎļþ!\n");
exit(0);}
fgets(ch,10000,fp);
printf("%s",ch);
......
#include <string.h>
#include <stdio.h>
void main()
{
int i;
char buf[]="abcde";
strncpy(buf,"abc",3);
for(i=0;i <5;i++)
printf("%c",buf[i]);
printf("\n");
}
ÇëÎʳöʲôÎÊÌâÁË£¿
LIBCD.lib(wincrt0.obj) ......
FILE *pFile;
errno_t m_err;
m_err = fopen_s(&pFile,"1.txt","r");
char ch[100];
memset(ch,0,100);
fread(ch,1,100,pFile);
MessageBox(ch);
fclose(pFile);
MessageBox(ch); ÎÒÒªÈçºÎ²ÅÄÜMESSAGEBOX ³öÀ´£¿ Ϊɶ VC6ÎÒ¿´µ½¿ÉÒÔ VC2008 ¾Í²»µÃÐ ......
13¸öÈËΧ³ÉһȦ£¬´ÓµÚÒ»¸öÈË¿ªÊ¼Ë³Ðò±¨ºÅ1£¬2£¬3¡£·²±¨µ½3ÕßÍ˳öȦ×Ó£¬ÕÒ³ö×îºóÁôÔÚȦ×ÓÖеÄÈËÔÀ´µÄÐòºÅ
½á¹ûÓ¦¸ÃÊÇ13 ¿ÉÎҵijÌÐòµÄ½á¹ûÊÇ11 Ï£ÍûºÃÐÄÈË°ï¸ÄÒ»ÏÂ
#include <stdio.h>
#include <stdlib.h>
int onlyone(int a[])
{
int i,k = 0;
for(i = 1;i <= 13;i++)
if(a[i ......