السلام عليكم أخي أتمنى ان تساعدني في اكتشاف المشكلة في هذا الكود
السؤال يريد أن اكتب برنامج يدخل المستخدم جملة
فيطبع البرنامج عكسها
أرجو مساعدتي في كشف الخطأ
كود:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
char word[30][19];
char *token;
char temp[100];
char sent[100];
printf("Enter a sentence\n");
gets(sent);
strcpy(temp,sent);
token=strtok(sent," ");
int i=0,j;
while(token !=NULL){
strcpy(word[i],token);
token=strtok(NULL," ");
for(j=1-1;j>0;j++){
printf("%s",word[i]);
printf(" ");}
}
return 0;
}