fork download
  1. #include <stdio.h>
  2. char *encode(char *s,int offset)
  3. {
  4. char *p=s;
  5. while (*p)
  6. {
  7. *p +=offset;
  8. }
  9. return s;
  10. }
  11. char *decode(char *sm ,int iffset)
  12. {
  13. char *p= sm;
  14. while(*p)
  15. {
  16. *p-=iffset;
  17. }
  18. return sm;
  19. }
  20. int main(){
  21. char *ss="hello";
  22. char * a=encode(ss);
  23. printf("%s\n",a);
  24. char *b=decode(a);
  25. printf("%d\n",b);
  26. return 0;
  27. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:21:11: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
  char *ss="hello";
           ^~~~~~~
prog.cpp:22:20: error: too few arguments to function ‘char* encode(char*, int)’
  char * a=encode(ss);
                    ^
prog.cpp:2:7: note: declared here
 char *encode(char *s,int offset)
       ^~~~~~
prog.cpp:24:18: error: too few arguments to function ‘char* decode(char*, int)’
  char *b=decode(a);
                  ^
prog.cpp:11:7: note: declared here
 char *decode(char *sm ,int iffset)
       ^~~~~~
stdout
Standard output is empty