0

I have a function that reads data from from array, but, when I'd like to print data instead of the name I get some trash: 4273 �нз знзнз. Where I made mistake?

A function, where student_list[i] = "4273 Константинопольский А. А. 4333 знзнз":

int debt() {
  char name[100];
  char test[5];
  int group;
  int exam;

  for (int i = 0; i < 4; i++) {
    sscanf(student_list[i], "%d %[^0-9] %d %s", &group, name, &exam, test);

    printf("%d %s %s\n", group, name, test);
  }
  return 0;
}
3
  • 1
    I don't think you can use unicode in C like this. Commented Dec 14, 2014 at 14:09
  • 1
    It could be the encoding , you can try using wchar Commented Dec 14, 2014 at 14:09
  • 4
    "знзнз" char test[5]; Commented Dec 14, 2014 at 14:10

1 Answer 1

1

Because size of char type in memory isn't enough for save unicode characters you should depend on your compiler use other types of data type like wchar or I can offer to you ,It's better use cuchar.h header file and solve your problem

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.