View Code of Problem 52

#include <stdio.h>
int main(){
  char str[100];
  scanf("%s",str);
  int i=0;
  while(str[i]!='/0'){
  i++;
  }
  int temp;
  for(int j=0,k=i-1;j<=i/2,k>j;j++;k--){
    temp=a[j];
    a[j]=a[k];
    a[k]=temp;
  }
  printf("%s",str);
}
/*
Main.c: In function 'main':
Main.c:6:17: warning: multi-character character constant [-Wmultichar]
   while(str[i]!='/0'){
                 ^~~~
Main.c:10:27: warning: left-hand operand of comma expression has no effect [-Wunused-value]
   for(int j=0,k=i-1;j<=i/2,k>j;j++;k--){
                           ^
Main.c:10:35: error: expected ')' before ';' token
   for(int j=0,k=i-1;j<=i/2,k>j;j++;k--){
      ~                            ^
                                   )
Main.c:11:10: error: 'a' undeclared (first use in this function)
     temp=a[j];
          ^
Main.c:11:10: note: each undeclared identifier is reported only once for each function it appears in
*/

Double click to view unformatted code.


Back to problem 52