Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


how to convert an char array to decimal array

Answers were Sorted based on User's Feedback



how to convert an char array to decimal array..

Answer / yogesh

#include<stdio.h>
int main()
{
char str[40],*s;
char ch,ask;
do
{
s=str;
printf("Enter the string:");
fgets(str,40,stdin);
do
{
printf("%d ",*s++);
}while(*s);
printf("\nDo u want to enter another string
(y/n):");
ask=getchar();
if(ask=='n')
break;
}while((ch=getchar())!='n');
printf("\n");
}

Is This Answer Correct ?    1 Yes 0 No

how to convert an char array to decimal array..

Answer / vignesh1988i

#include<stdio.h>
#include<conio.h>
void main()
{
char a1[50];
int a2[50];
printf("enter the characters :");
gets(a1);
for(int i=0;a1[i]!='\0';i++)
a2[i]=(int)a1[i]; // TYPE CASTING
for(i=0;a1[i]!='\0';i++)
printf("%d",a2[i]);
getch();
}


thank you

Is This Answer Correct ?    2 Yes 2 No

how to convert an char array to decimal array..

Answer / raj

main()
{
int a[5];
char c[5]={'1','2','3','4','5'};
int i;
for(i=0;i<5;i++)
a[i]=c[i]-'0';
for(i=0;i<5;i++)
printf("%d ",a[i]);
}

Is This Answer Correct ?    0 Yes 0 No

how to convert an char array to decimal array..

Answer / kanakaraju

#include< stdio.h>
#include<conio.h>
main()
{
int a[5];
char c[5]={'1','2','3','4','5'};
int i;
for(i=0;i<5;i++)
a[i]=c[i]-'0';
for(i=0;i<5;i++)
printf("%d ",a[i]);
}

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

Write an algorithm for a program that receives an integer as input and outputs the product of of its digits. E.g. 1234 = 24, 705 = 0

4 Answers  


What is the difference between fork() and vfork()?

2 Answers  


how to make c program without a libary? e.g.#include<stdio.h> libary is not in c progaram.

2 Answers  


What is a list in c?

0 Answers  


how to use virual function in real time example

1 Answers   CTS, Wipro,


WAP to convert text into its ASCII Code and also write a function to decode the text given?

2 Answers  


How can I allocate arrays or structures bigger than 64K?

5 Answers  


How can I find out the size of a file, prior to reading it in?

0 Answers  


What is variable declaration and definition in c?

0 Answers  


What is an lvalue?

0 Answers  


Hierarchy decides which operator a) is most important b) is used first c) is fastest d) operates on largest numbers

1 Answers  


List the variables are used for writing doubly linked list program.

0 Answers   Infosys, Wipro,


Categories