Displays the error error: use of undeclared identifier 'with' .

#include <stdio.h> #include <cs50.h> #include <stdlib.h> #include <string.h> int main(int argc, string argv[]) { if (argc == 2) { string c, p; int k, n; k = atoi(argv[1]); p = get_string("enter text: "); n = strlen(p); for (int i = 0; i < n; i++) { с[i] = p[i] + k; printf("%c", c[i]); } } else { printf("you must pass two arguments."); return 1; } } 

Closed due to the fact that off-topic participants Kromster , freim , aleksandr barakin , andreymal , mkkik May 31 at 9:04 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • "The question is caused by a problem that is no longer reproduced or typed . Although similar questions may be relevant on this site, solving this question is unlikely to help future visitors. You can usually avoid similar questions by writing and researching a minimum program to reproduce the problem before publishing the question. " - Kromster, freim, aleksandr barakin, andreymal, mkkik
If the question can be reformulated according to the rules set out in the certificate , edit it .

    1 answer 1

    First, you have с[i] = p[i] + k; Russian с .

    Secondly, in the CS50 string is just char * . Therefore, your c[i] is an attempt to access through an uninitialized pointer.

    • hmm, si I started to learn recently, pointers and work with memory have not yet passed, in python there is no such thing just). can you somehow simplify the option "second"? but I did not understand, forgive the foolish) - Lython
    • @Lython: Well, I don’t understand by your code why you even need the c array. Why, really? Why not just make char c = p[i] + k; printf("%c", c); char c = p[i] + k; printf("%c", c); ? Why an array? Without knowing the answer to this question, I cannot judge what and how to correct here. - AnT
    • Well, I wanted to save the encrypted text - Lython
    • @Lython: Well then - just allocate memory manually. When you already know the value of n , do c = malloc(n + 1) . And don't forget to add a terminator at the end of c if you want to get a C-string. - AnT
    • all, stop beating my brain - Lython