fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <cs50.h>
  4.  
  5.  
  6. int main() {
  7.  
  8. int k = 5;
  9. string msg = "hello";
  10.  
  11. for (int i = 0; i < strleng(msg); i++) {
  12. printf("%c", msg[i] + k);
  13. }
  14.  
  15. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function ‘main’:
prog.c:8:1: error: unknown type name ‘string’
 string msg = "hello";
 ^
prog.c:8:14: warning: initialization makes integer from pointer without a cast [enabled by default]
 string msg = "hello";
              ^
prog.c:10:1: error: ‘for’ loop initial declarations are only allowed in C99 mode
 for (int i = 0; i < strleng(msg); i++) {
 ^
prog.c:10:1: note: use option -std=c99 or -std=gnu99 to compile your code
prog.c:10:1: warning: implicit declaration of function ‘strleng’ [-Wimplicit-function-declaration]
prog.c:11:22: error: subscripted value is neither array nor pointer nor vector
      printf("%c", msg[i] + k % 90 + 65);
                      ^
prog.c:14:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
stdout
Standard output is empty