Thread: prinf show unknown character

  1. #1
    Registered User
    Join Date
    Mar 2011

    prinf show unknown character

    i use printf to display char array but it show like this :yru�sianl�g(.
    It suppose to display :yrusianlg
    anyone can teach me how to remove the unknown character..
    Please Help me

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    You should show us how you copied the characters into the array to begin with.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Mar 2011
    This is the code
    #include <stdio.h>
    #include <string.h>
    #include <stdlib.h>
    #include <time.h>
    void shuffle(char *array, size_t n)
      if (n > 1) {
        size_t i;
        for (i = 0; i < n - 1; i++) {
          size_t j = i + rand() / (RAND_MAX / (n - i) + 1);
          char *t = array[j];
          array[j] = array[i];
          array[i] = t;
    int main()
      char a[5][20] = {
    char *word = (char*) malloc(6);
      int i,rndm,cndtn=0;
    char *comp= (char*) malloc(6);
    char z[100],msg[1000];
    rndm = rand()%5;
      for (i = 0; i < strlen(a[0]); i++)
        z[i] = a[rndm][i];
    printf("Clues :");
    //  for (i = 0; i < strlen(z); i++)
      return 0;
    i want to make the word shuffle....

  4. #4
    Registered User
    Join Date
    Mar 2011
    nvm i solve already..i wrongly put array lenght..thx anyway

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. warning: multi-character character constant
    By aadil7 in forum C Programming
    Replies: 2
    Last Post: 12-12-2010, 10:02 PM
  2. wide character (unicode) and multi-byte character
    By George2 in forum Windows Programming
    Replies: 6
    Last Post: 05-05-2007, 12:46 AM
  3. show() method does not show...
    By kocika73 in forum C++ Programming
    Replies: 12
    Last Post: 04-09-2006, 09:27 PM
  4. Unknown Error(c-lang), while reading a character from file
    By c_square in forum C++ Programming
    Replies: 2
    Last Post: 01-14-2005, 04:00 AM