Skip to main content

Okay this is driving me nuts.. i have looked at a bunch of these questions which are the exact same.... but none of the answers help.... Basically in my code this is how it goes:

`

if(argc != 2 || k <= 0){
    printf("YOU SCREWED UP!\n");
    return 1;
}
else{
       
    // everything that happens.. it works so i can't give away the answer but what happens is not my problem...
}

`

So i have tried putting everything outside of the elseelse block as well as tried not to print anything... the first ifif block.. i don't see whats wrong yet cs50cs50 IDE keeps nagging me about this. This is how the program runs:

make caesar clang -ggdb3 -O0 -std=c99 -Wall -Werror caesar.c -lcs50 -lm -o caesar jharvard@appliance (~/Dropbox/workspace/pset2): ./caesar Segmentation fault (core dumped) jharvard@appliance (~/Dropbox/workspace/pset2): ./caesar -2 YOU SCREWED UP! jharvard@appliance (~/Dropbox/workspace/pset2): ./caesar adawdw daf4 YOU SCREWED UP! jharvard@appliance (~/Dropbox/workspace/pset2): ./caesar 5 foo YOU SCREWED UP!

 make caesar
 clang -ggdb3 -O0 -std=c99 -Wall -Werror    caesar.c  -lcs50 -lm -o caesar
 jharvard@appliance (~/Dropbox/workspace/pset2): ./caesar
 Segmentation fault (core dumped)
 jharvard@appliance (~/Dropbox/workspace/pset2): ./caesar -2
 YOU SCREWED UP!
 jharvard@appliance (~/Dropbox/workspace/pset2): ./caesar adawdw daf4
 YOU SCREWED UP!
 jharvard@appliance (~/Dropbox/workspace/pset2): ./caesar 5 foo
 YOU SCREWED UP!

Also... I know there are numerous other questions regarding the same thing.. but i have tried them ALL.. with no luck.. hope u can help

Okay this is driving me nuts.. i have looked at a bunch of these questions which are the exact same.... but none of the answers help.... Basically in my code this is how it goes:

`

if(argc != 2 || k <= 0){
    printf("YOU SCREWED UP!\n");
    return 1;
}
else{
       
    // everything that happens.. it works so i can't give away the answer but what happens is not my problem...
}

`

So i have tried putting everything outside of the else block as well as tried not to print anything... the first if block.. i don't see whats wrong yet cs50 keeps nagging me about this. This is how the program runs:

make caesar clang -ggdb3 -O0 -std=c99 -Wall -Werror caesar.c -lcs50 -lm -o caesar jharvard@appliance (~/Dropbox/workspace/pset2): ./caesar Segmentation fault (core dumped) jharvard@appliance (~/Dropbox/workspace/pset2): ./caesar -2 YOU SCREWED UP! jharvard@appliance (~/Dropbox/workspace/pset2): ./caesar adawdw daf4 YOU SCREWED UP! jharvard@appliance (~/Dropbox/workspace/pset2): ./caesar 5 foo YOU SCREWED UP!

Also... I know there are numerous other questions regarding the same thing.. but i have tried them ALL.. with no luck.. hope u can help

Okay this is driving me nuts.. i have looked at a bunch of these questions which are the exact same.... but none of the answers help.... Basically in my code this is how it goes:

`

if(argc != 2 || k <= 0){
    printf("YOU SCREWED UP!\n");
    return 1;
}
else{
       
    // everything that happens.. it works so i can't give away the answer but what happens is not my problem...
}

`

So i have tried putting everything outside of the else block as well as tried not to print anything... the first if block.. i don't see whats wrong yet cs50 IDE keeps nagging me about this. This is how the program runs:

 make caesar
 clang -ggdb3 -O0 -std=c99 -Wall -Werror    caesar.c  -lcs50 -lm -o caesar
 jharvard@appliance (~/Dropbox/workspace/pset2): ./caesar
 Segmentation fault (core dumped)
 jharvard@appliance (~/Dropbox/workspace/pset2): ./caesar -2
 YOU SCREWED UP!
 jharvard@appliance (~/Dropbox/workspace/pset2): ./caesar adawdw daf4
 YOU SCREWED UP!
 jharvard@appliance (~/Dropbox/workspace/pset2): ./caesar 5 foo
 YOU SCREWED UP!

Also... I know there are numerous other questions regarding the same thing.. but i have tried them ALL.. with no luck.. hope u can help

Source Link

Handles lack of argv[1]

Okay this is driving me nuts.. i have looked at a bunch of these questions which are the exact same.... but none of the answers help.... Basically in my code this is how it goes:

`

if(argc != 2 || k <= 0){
    printf("YOU SCREWED UP!\n");
    return 1;
}
else{
       
    // everything that happens.. it works so i can't give away the answer but what happens is not my problem...
}

`

So i have tried putting everything outside of the else block as well as tried not to print anything... the first if block.. i don't see whats wrong yet cs50 keeps nagging me about this. This is how the program runs:

make caesar clang -ggdb3 -O0 -std=c99 -Wall -Werror caesar.c -lcs50 -lm -o caesar jharvard@appliance (~/Dropbox/workspace/pset2): ./caesar Segmentation fault (core dumped) jharvard@appliance (~/Dropbox/workspace/pset2): ./caesar -2 YOU SCREWED UP! jharvard@appliance (~/Dropbox/workspace/pset2): ./caesar adawdw daf4 YOU SCREWED UP! jharvard@appliance (~/Dropbox/workspace/pset2): ./caesar 5 foo YOU SCREWED UP!

Also... I know there are numerous other questions regarding the same thing.. but i have tried them ALL.. with no luck.. hope u can help