c언어 3번째 질문좀 드릴게요,ㅠ
오나미
2023.04.01
질문 제목 : 답과 설명좀 부탁드려요 ㅠ질문 내용 :
3. sum 의 결과를 예측하시오.
#include stdio.h
#include stdlib.h
int main()
{
int c = 0, a=1, b=5,sum = 0;
while(a=b)
{
a++;
if(a%2 == 0)
{
c++;
sum += a;
}
}
printf(sum = %d\n,sum);
system(pause);
return 0;
}
4. 붉은색 부분을 정확히 이해하기 바람.
#include stdio.h
#include stdlib.h
char* strcpy(char *, char *);
int main() {
char str[]=hello, c;
char dest[20];
char *pt;
printf(%s\n,str);
pt = strcpy(dest, str);
printf(%s\n,pt);
system(pause);
return 0;
}
char * strcpy(char *s, char *t)
{
char *pt = s;
while(*s++ = *t++);
return pt;
}