how to convert an char array to decimal array
Answers were Sorted based on User's Feedback
#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 |
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 |
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 |
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 |
What is key word in c language?
what is call by value and call by reference
write a program in 'c' to find the value of p[i+1]^n.p,i,n are arguments of a macro and n is a integer
main use of recursive function a) processing speed high b) reduce program length/reduce repeated statements c) if you do not, use iterative methods like, for, while or do-while d) all the above
How many bytes is a struct in c?
#include<stdio.h> main() { char s1[]="Ramco"; char s2[]="Systems"; s1=s2; printf("%s",s1); } Find the output
process by which one bit patten in to another by bit wise operation is? (a) masking, (b) pruning, (c) biting, (d) chopping,
What does s c mean on snapchat?
how to find a 5th bit is set in c program
What is meant by type specifiers?
Which header file should you include if you are to develop a function which can accept variable number of arguments?
What does 4d mean in c?