Home » C solved programs » Advance C programs

C program to convert String into Hexadecimal

In this program we will read a String and convert the string into Hexadecimal String. We will convert each character of the string in it’s equivalent hexadecimal value and insert the converted value in a string and finally print the Hexadecimal String.

Converting String into Hexadecimal String using C program

/*C program to convert String into Hexadecimal.*/

#include <stdio.h>
#include <string.h>

int main()
	unsigned char str[100],strH[200];
	int i,j;
	printf("Enter string: ");
	printf("\nString is: %s\n",str);
	/*set strH with nulls*/
	/*converting str character into Hex and adding into strH*/
	strH[j]='\0'; /*adding NULL in the end*/
	printf("Hexadecimal converted string is: \n");
	return 0;
Enter string: Hello world, This is my first program.

String is: Hello world, This is my first program.
Hexadecimal converted string is: 

Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.