how can i cast a char type array to an int type array
Answers were Sorted based on User's Feedback
Answer / moolshankershukla
int a[10];
char b[10];
a[10]=(char) b[10]; // type casting char type into int type.
Is This Answer Correct ? | 4 Yes | 1 No |
Answer / harish
int b[10];char a[10];
for(int i=0;i<10;i++)
b[i]=(int)a[i];
Is This Answer Correct ? | 1 Yes | 0 No |
why array index always strats wuth zero?
Sir... please give some important coding questions asked by product companies..
write a function to give demostrate the functionality of 3d in 1d. function prototye: change(int value,int indexX,int indexY,int indexZ, int [] 1dArray); value=what is the date; indexX=x-asix indexY=y-axis indexZ=z-axis and 1dArray=in which and where the value is stored??
void main() { static int i; while(i<=10) (i>2)?i++:i--; printf(“%d”, i); }
how can u draw a rectangle in C
53 Answers Accenture, CO, Codeblocks, Cognizant, HCL, Oracle, Punjab National Bank, SAP Labs, TCS, University, Wipro,
Print an integer using only putchar. Try doing it without using extra storage.
main() { int i; float *pf; pf = (float *)&i; *pf = 100.00; printf("\n %d", i); } a. Runtime error. b. 100 c. Some Integer not 100 d. None of the above
There were 10 records stored in “somefile.dat” but the following program printed 11 names. What went wrong? void main() { struct student { char name[30], rollno[6]; }stud; FILE *fp = fopen(“somefile.dat”,”r”); while(!feof(fp)) { fread(&stud, sizeof(stud), 1 , fp); puts(stud.name); } }
# include <stdio.h> int one_d[]={1,2,3}; main() { int *ptr; ptr=one_d; ptr+=3; printf("%d",*ptr); }
main(){ char a[100]; a[0]='a';a[1]]='b';a[2]='c';a[4]='d'; abc(a); } abc(char a[]){ a++; printf("%c",*a); a++; printf("%c",*a); }
#include <stdio.h> #define a 10 main() { #define a 50 printf("%d",a); }
main() { float me = 1.1; double you = 1.1; if(me==you) printf("I love U"); else printf("I hate U"); }