EmbLogic's Blog

problem in conversion of string

hi,
how to convert a given lower case string into upper case

5 Responses to problem in conversion of string

  1. two ways :
    1) using a pre defined function toupper() which requires the header file ctype.h to be included in your program.
    e.g
    char f1=’h’;
    f1=toupper();
    now f1=’H’
    2) you can also define a function which uses the ASCII values of characters if the character is a lower case laphabet subtract 32.

  2. hemant.kumar says:

    char arr[]=”HELLO WORLD”;
    for(i=0;i<strlen(arr);i++)
    {
    arr[i]=toupper(*(arr+i));
    }

  3. nishank aggarwal says:

    #include
    int main()
    {
    char str[];int l;
    pf(“\nenter any name=”);
    sf(“%s”,&str);
    l=0;
    while(str[l] !=”)
    {
    str[l] = str[l] – 32;
    l++;
    }
    pf(“\nupper case = %s”,str);
    return 0;
    }

  4. nishank aggarwal says:

    this is str[l]!= ”………….

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>