Cho em hỏi tại sao output của bài này nó lại ra thế này ạ?
#include<stdio.h>
#include<conio.h>
#include<string.h>
int main (){
char mess[]="more";
char *ptr;
ptr= mess+strlen(mess);
while(ptr>mess) printf("%s",--ptr);
}
output:
ereoremore
Cho em hỏi tại sao output của bài này nó lại ra thế này ạ?
#include<stdio.h>
#include<conio.h>
#include<string.h>
int main (){
char mess[]="more";
char *ptr;
ptr= mess+strlen(mess);
while(ptr>mess) printf("%s",--ptr);
}
output:
ereoremore
Vì %s sẽ in chuỗi từ vị trí con trỏ đến hết nên chuỗi xuất hiện sẽ là
e#re#ore#more
Nếu in xâu đảo ngược thì là %c thôi
Đề thi trường em ~.~ nhìn vào hoa cả mắt
83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?