| Forums.Sureshkumar.net : A Perfect Place to Share Knowledge Blogs Games Magazines |
|
|||||||
| ds. c , c++ Interview / Technical Questions Kindly solve an many as questions you can. It will sharpen your skills and those solutions will help others too. |
![]() |
|
|
LinkBack | Thread Tools | Rate Thread | Display Modes |
|
|
#1 (permalink) |
|
Senior Member
Join Date: Oct 2006
Location: In Bangalore
Age: 24
Posts: 126
Thanks: 1 Thanked 6 Times in 6 Posts Thanks: 1
Thanked 6 Times in 6 Posts
Rep Power: 0
|
WAP to convert a lower case string to higher case and vice versa
WAP to convert a lower case string to higher case and vice versa
Sample I/P : hello O/P : HELLO |
|
|
|
|
|
#2 (permalink) |
|
Senior Member
Join Date: Oct 2006
Location: In Bangalore
Age: 24
Posts: 126
Thanks: 1 Thanked 6 Times in 6 Posts Thanks: 1
Thanked 6 Times in 6 Posts
Rep Power: 0
|
Re: WAP to convert a lower case string to higher case and vice versa
#include<stdio.h>
int cap_small(char *); int main() { char str[] = "hello"; cap_small(str); printf("%s\n",str); } int cap_small(char *ptr) { while(*ptr != '\0') { *ptr = *ptr - ('a' - 'A'); *ptr++; } } ~ |
|
|
|
|
|
#3 (permalink) |
|
Junior Member
Join Date: Jul 2007
Posts: 1
Thanks: 0 Thanked 0 Times in 0 Posts Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 2
|
Re: WAP to convert a lower case string to higher case and vice versa
may be better and fast.
if you XOR each character one by one by 32. it converts vice versa. Ex:- char p[]={ChAiR}; while(p) { p[i]=p[i]^32; } |
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|